// Get posts with no thumbnails //add_action('wp_head', 'sz_posts_without_thumbs'); function sz_posts_without_thumbs() { $args = array( 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => -1, 'fields' => 'ids', 'no_found_rows' => true, 'ignore_sticky_posts' => true, 'meta_query' => array( array( 'key' => '_thumbnail_id', 'compare' => 'NOT EXISTS', ), ), ); $news_query = new WP_Query($args); $news_post_ids = $news_query->posts; echo "\n"; if (!empty($news_post_ids)) { foreach ($news_post_ids as $post_id) { $post_url = get_permalink($post_id); echo "$post_url
"; } } }