Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to use the loop inside custom post settings.
However this results in several errors the most common being the following: when I click on a post on the admin it always goes to the the last post.

The code that I use is:

$original_query = $wp_query;
$wp_query = null;
$args = array( 'nopaging' => true, 'cat' => $e->cat_ID );
$wp_query = new WP_Query( $args );
while ( $wp_query->have_posts() ) : $wp_query->the_post();
   $output .= '<option>'.get_the_title().'</option>';
endwhile; 

wp_reset_postdata();
$wp_query = null;
$wp_query = $original_query;

any help would be very much appreciated!!
thanks

share
comments disabled on deleted / locked posts

merged by Rarst Jul 4 '11 at 10:04

this question was merged with Using the loop inside admin because it is an exact duplicate of that question.

migrated from stackoverflow.com Jul 4 '11 at 5:49

This question came from our site for professional and enthusiast programmers.

Browse other questions tagged or ask your own question.