How to remove all posts that do not have a Featured images assigned to them?
-
How to remove all posts that do not have a Featured images assigned to them?
How to make a mini plugin for when I activate it, it deletes all posts without a featured images assigned to them?
I trying:
add_action( 'init', 'process_posts' ); function process_posts() { $args = array( 'meta_query' => array( array( 'key' => '_thumbnail_id', 'value' => '?', 'compare' => 'NOT EXISTS' ) ), ); $new_query = new WP_Query( $args ); if (empty($_thumbnail_id)) { wp_delete_post($_POST['post_id'], true); } }
Can someone show this to me, please?. Thanks
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to remove all posts that do not have a Featured images assigned to them?’ is closed to new replies.