Konstantin Kovshenin: Snippet! Change the year of all posts in a particular category to 2012 with a …
Published on Planet Wordpress | shared via feedly mobile
Snippet! Change the year of all posts in a particular category to 2012 with a single SQL query (use with phpMyAdmin or the MySQL command line interface)
UPDATE wp_posts AS p JOIN wp_term_relationships AS tr ON tr.object_id = p.id JOIN wp_term_taxonomy AS tt ON tt.term_taxonomy_id = tr.term_taxonomy_id JOIN wp_terms AS t ON tt.term_id = t.term_id SET p.post_date = REPLACE(p.post_date, YEAR(p.post_date), 2012) WHERE t.slug = 'my-category-slug' AND tt.taxonomy = 'category';
Obviously replace my-category-slug with the category you'd like to target and perform the same magic on the p.post_date_gmt field. Not entirely sure why you would use such a technique, but it was asked by James Edwards on Twitter.
Source: Snippet! Change the year of all posts in a particular category to 2012 with a ... by Konstantin Kovshenin
Sent from my iPhone