The Debug Bar Query Tracer addon for the popular Debug Bar plugin is a real lifesaver, especially when you’re dealing with plugins or themes employing heavy rewrites.
Note to self: Get up to date on WP Trac digests be…
Note to self: Get up to date on WP Trac digests before submitting new tickets. Prevents foot-in-mouth disorder 99 percent of the time.
Query based on whether posts have a featured image
Ever need to query for posts based whether they have a post thumbnail? This can be accomplished by adding 'meta_key' => '_thumbnail_id'
to the query args:
<?php $args = array( 'posts_per_page' => 1, 'meta_key' => '_thumbnail_id' ); $my_query = new WP_Query( $args ); if ( $my_query->have_posts() ) : while ( $my_query->have_posts() ) : $my_query->the_post(); ...