mysql - Update a range of post dates with SQL query in phpMyadmin -


i trying update number of post(around 7000) in wordpress database post dates within range of dates using sql query:

update `wp_posts` set post_date="2015-07-22 20:31:30" post_date between '2015-07-31 00:00:00' , '2015-12-14 00:00:00' , post_status="publish" 

i need find posts has dates 2015-07-31 00:00:00 2015-12-14 00:00:00 , update them 2015-07-22 20:31:30 , make them published

my server running sql server 5.5.44

what doing wrong here?

thanks

in query you're selecting posts publish status instead of update them publish. try query instead:

update `wp_posts` set post_date="2015-07-22 20:31:30", post_status="publish" post_date between '2015-07-31 00:00:00' , '2015-12-14 00:00:00' , post_type = "post" 

i added post_type condition don't want change revisions or other posts type.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -