How to check in functions.php if there is data in a WP_Query?
You can check if the query returned any posts by doing $home_query->have_posts(). $home_query = new WP_Query( array(‘posts_per_page’ => get_query_var(‘posts_per_page’),’paged’ => $current_page ) ); if( !$home_query->have_posts() ){ // Do this if $home_query had no posts. }