Support » Fixing WordPress » wp_query not working in admin page?!?

  • in a plugin i am writing, the function i am using in the add_menu_page function to display the admin page is below… the function below simply runs an endless loop over all the posts in the database and hangs everything up even though the meta_query should limit it and if not then the posts_per_page should at least keep it from hanging up if the meta_query dosent work.

    it’s as if it is ignoring WP_Query completely, does anyone know what is going on?!

    function admin_page_output() {
     global $post, $wpdb;
    $args = array(
    	'post_type' => 'post',
    	'cache_results' => false,
    	'posts_per_page' => 10,
    	'meta_query' => array(
    		array(
    			'key' => 'ywg_newsletter_included',
    			'value' => 'true',
    			'compare' => '='
    		)
    	)
     );
    $the_query = new WP_Query( $args );
    
    while($the_query->have_posts()) : the_post();
    echo '<li><input type="checkbox" name="'.$GLOBALS['post']->ID.'">'.the_title('','',false).'</li>';
    endwhile;
  • The topic ‘wp_query not working in admin page?!?’ is closed to new replies.