You don’t need to call wp_reset_query()
here, because you’re not modifying the main query. Instead, call wp_reset_postdata()
.
You only need to call wp_reset_query()
when modifying the main loop via query_posts()
(which you shouldn’t do, anyway, so you should never need to call wp_reset_query()
).
But new WP_Query()
, with a properly instantiated loop – i.e. one that calls the_post()
– will stomp on the $post
data for the main query. So, after closing your custom WP_Query()
loop, call wp_reset_postdata()
to restore $post
data to the main query.
Related Posts:
- Using wp_query is it possible to orderby taxonomy?
- “tax_query” parameter not working with WP_Query
- How do I exclude a custom taxonomy from the post loop
- Custom Taxonomy and Tax_Query
- WordPress database error: [Not unique table/alias: ‘wp_postmeta’]
- Using WordPress to make a “Product Search” type navigation drilldown
- Custom Taxonomy not working with posts_per_page in new WP_query (pagination problem)
- display posts with same taxonomy term
- Including all terms in wordpress tax_query
- How to get first post in a category of a custom taxonomy
- Display one post from each term in a custom taxonomy [closed]
- How much faster is a tax query than a meta query?
- Using tax_query creates a 1 = 0 or 1 = 1 in $wp_query->request
- Use custom posts as taxonomy term meta replacement?
- search query within custom taxonomy term, post title and meta field
- Is it possible to sort the post based on a custom field?
- wp query with multiple taxonomy?
- wp_query orderby title and meta key value (WP3.1)
- On Taxonomy Template page, want to add Post_Type
- Page queried instead of a custom taxonomy
- List Custom Taxonomy Values according to a Post Meta Value
- Custom WP_Query breaks default behaviour of viewing right post associated with tax-term!
- The next_posts_link() show me a aditional page in blank
- Help with a query not working with custom taxonomy
- Adding session variable and/or cookie based on user-selected input
- Excluding a custom taxonomy term breaks wp_get_post_terms
- Advanced Tax Query
- why do drafts return as part of wp_query?
- Improving WP_Query performance for multiple taxonomies
- WP Query with custom taxonomy
- how to search in custom fields & custom taxonomy for custom search
- get_the_terms() to show all custom taxonomies
- Single reusable value for post meta: Custom Taxonomy or Post Meta?
- WP_Query on custom taxonomy works fine but fails if run through wp_ajax_
- Advanced Query Logic With Multiple Taxonomies
- How do I Use Multiple Loops with WP_Query?
- cannot get multiple loops using tax_query
- Display all posts for taxonomy term across multiple custom post types
- Selecting all posts from the children of a particular parent taxonomy
- What is faster: custom taxonomy or serialized post-meta for db retrieval? (over 60,000 posts)
- Is it possible to store Json data in post_meta and manipulate
- Add Custom Taxonomy for Blog Meta Info
- How to separate posts in loop?
- Creating terms vs custom post meta to save data?
- Hiding taxonomies with no children WP_Query & tax_query
- Can I use OR relation for one item when calling tax_query from WP_Query and use AND for the rest?
- Set tax_query conditionally with new WP_Query
- querying posts by custom taxonomy terms right from a querystring based URL
- Does using custom taxonomy is more CPU efficient than using meta_data?
- Query custom taxonomy by term id?
- When filtering query on custom taxonomy; main menu dissapears
- Exclude taxonomy term from all loops, but having it on widget
- Why can’t I use an array of term slugs in WP_Query?
- Using WP_Query and Query_post for the loop?
- Problem with wordpress pagination
- How to do a particular wp_query taxonomy search
- Count of posts by different parameters?
- Wp_query…a type of term a different div
- check if a taxnomy queried in $wp_query?
- Taxonomy.php how to show post only in current taxonomy with wp_query?
- WP_Query tax_query – Show results if child has parent X
- WooCommerce custom taxonomy as meta?
- Query custom taxonomy for category including children
- Proper way to create taxonomy queries
- how to use tax_query to apply both terms or one if one is empty
- Get current page term title to use in WP_Query
- passing moree than one value of slugs in taxonomy using variable
- Sort taxonomy page alphabetically by meta rather than default post date
- Convert post meta to custom taxonomy?
- Count tags for current post and save into custom meta field (and update it on post edit)
- Is it possible to sort the post based on a custom field?
- Custom post type term names with ampersand in the term name
- WordPress custom post type
- Looking for suggestions on creating simple database (Help!!)
- Values inside a custom field to determine which category posts to display
- How do you move custom fields to custom taxonomies using WP Queries
- WordPress hiding posts without content on custom taxonomy query. How to solve?
- get meta fields and taxonomy of any post type
- Where to put a migration script to switch post information?
- Run next query based on first query’s term
- Get the original menu item name string instead of the label
- How to use tax_query other than by slug or id or solve custom taxonomy tags conflicts with pre-existing tags?
- Order posts with custom taxonomy array
- Getting grandchildren of a post with a specified custom taxonomy?
- Taxonomy Parameters in WP Query to get posts from two different taxonomies
- Update fields with post object and custom tax with wp_insert_post
- How can I show custom field according to taxonomy?
- Custom Taxonomy + JQuery Tabs
- Advanced AND tax_query in sidebar with 2 taxonomies
- How to query posts that are not related to any term of a taxonomy?
- Using wp_query is it possible to orderby taxonomy?
- How to limit posts to 1 from each term with tax_query?
- Loop posts without any taxonomy
- Custom taxonomy with custom meta value is not sorting correctly (query returns the same value for orderby regardless of sort column click)
- WP REST API no longer supports filter param, so how do I get posts in a custom taxonomy?
- Get value in custom field with taxonomy [closed]
- Custom taxonomy link opens under Posts
- How to Create Multi selection search Form using Default WordPress Category Terms, and Custom post Types Taxonomies Terms?
- Restrict viewing of posts by category, user role
- Does a codex exist for creating meta boxes in taxonomy