Last active
February 3, 2016 20:52
-
-
Save aschweigert/9dd8391d7c47cbe11c80 to your computer and use it in GitHub Desktop.
set featured images to false before X date
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drop temporary table if exists post_ids; | |
create temporary table if not exists post_ids | |
select ID from wp_14_posts | |
where post_status = 'publish' | |
and post_type = 'post' | |
and post_date < '2016-02-03 00:00:000'; | |
delete wp_14_postmeta from wp_14_postmeta join post_ids | |
on wp_14_postmeta.post_id = post_ids.ID | |
and wp_14_postmeta.meta_key = 'featured-image-display'; | |
insert into wp_14_postmeta (post_id, meta_key, meta_value) | |
select ID, 'featured-image-display', false | |
from post_ids; | |
/* to check your work | |
select * from wp_14_postmeta a | |
right join post_ids b | |
on a.post_id = b.ID | |
and a.meta_key = 'featured-image-display';*/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment