Support » Fixing WordPress » Change post dates in bulk using plugin or sql query

  • Resolved helpthisnewbie

    (@helpthisnewbie)


    I tried to find a plugin or sql tutor about this, but couldn’t find it. I am trying to change certain posts (filtered by post dates) with a plugin or sql command all at once.

    For example, I want to change all the posts from March 10, 2015 to March 18, 2015 (has around 100 posts). Is it possible to do this?

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    Yes, there is a way how to do it:

    I advise you to make a backup copy of your database before doing this, in case something goes wrong.

    1) Go to your phpMyAdmin
    2) click on the “wp_posts” table
    3) click the “SQL” tab at the top of the page
    4) paste in the following code (I used the dates you provided):

    UPDATE 'wp_posts'
    SET post_date = "2015-03-18 23:50:30"
    WHERE post_date BETWEEN '2015-03-15 00:00:00' AND '2015-03-15 23:59:59'
    AND post_status = "publish"

    5) click Go. This should work.

    I advise you to make a backup copy of your database before doing this, in case something goes wrong.

    ~ Janis

    Hi Janis,

    Thank you so much, it worked! I just had to add at the end

    AND post_type = “post”;

    so it won’t change other custom types in the table.

    Have a great day!

    Hi Janis,

    I am trying with your code. It brings me this error:

    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''wp_posts'
    SET post_date = "2015-07-22 23:50:30"
    WHERE post_date BETWEEN '2015' at line 1

    I am using:

    UPDATE'wp_posts'
    SET post_date="2015-07-22 20:31:30"
    WHERE post_date BETWEEN '2015-07-31 00:00:00' AND '2015-12-14 00:00:00'
    AND post_status="publish"

    Any help would be appreciated. My SQL server version is 5.5.44

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change post dates in bulk using plugin or sql query’ is closed to new replies.