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!!