I have a query which looks like this:
$args = arguments for the query $query = new WP_Query($args); while ($query->have_posts()): $query->the_post(); $post_id = get_the_ID(); echo my_function($post_id); endwhile; wp_reset_query(); endif;
my_function there's another query with a second function. This second function uses the
post_id as input:
$args = arguments for the query, using `$post_id` as input while ($query->have_posts()): $query->the_post(); // Do stuff endwhile; wp_reset_query(); endif;
The problem is that the output of the first query (which uses
my_function) isn't correct. The query in
my_function seems to mess up the loop.
As you can see I use
wp_reset_query() and I've also tried
my_function outputs some post information, among which the title. It displays the title of the current page (the page on which the query is) instead of the title of the post queried, so I think I'm missing something regarding resetting the query.