I have this code in a home.php to fetch the pages,
$args=array( 'post_type' => 'page', 'order' => 'ASC', 'orderby' => 'menu_order', 'post_status' => 'publish' ); $main_query = new WP_Query($args); if( have_posts() ) :
It is working fine everywhere except for one customer. It is not returning anything and always hitting the else block.
The WordPress version on which the site is running is 3.6. I already tested this on 3.6 in my preview sites and it is working fine there.
What might be the reason for WP_Query to not work?
Check the 3rd party plugins, one of them may cause the problem.
if($main_query->have_posts()) : $main_query->the_post();
Any idea why it is working in other sites where I just have have_posts()? Just curious to know the details.
if you use query_posts, then:
query_posts($args); if( have_posts() ) :
if you use WP_Query, then:
$main_query = new WP_Query($args); if( $main_query->have_posts() ) :
that is the basic…