WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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>';

$wp_query = null;
$wp_query = $original_query;

any help would be very much appreciated!!


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.