If wp_reset_postdata()
doesn’t work as expected you can backup the original $post
object by inserting
global $post; // if you aren't in global scope
$postBk=$post;
before doing your WP_Query and restore it with
$post=$postBk;
right after wp_reset_postdata();
Related Posts:
- Display one latest post from multiple categories
- Exclude category from loop not working
- Query Posts Exclude Entire Category
- Order by category titles
- Pagination on category.php and tag.php not working
- Problem with different query loops (and “main loop”) on category template page!
- Get posts from sites in Multisite?
- Exclude the category from the WordPress loop
- get_field not displaying my custom field value
- Rearranging posts based on categories
- WP_Query not looking at child category
- Randomise results from a category page?
- Does the ‘cat’ argument in query_posts fetch posts from subcategories as well as the given ID?
- Show div only if post is in specific category
- How to show a category post to a specific registered user
- Display list of Sub-Categories and the posts they contain, within one main Category
- Remove child products from woocommerce category page [closed]
- Get a list of commas separated categories inside a loop
- How do I get the total number of categories in a list of search results?
- Check if post belongs to any category
- How do I display the posts from a custom post type on a category.php page?
- How to group the loop posts in a particular by author?
- Display products for a category, sorted by post_excerpt
- “NOT ONLY IN” taxonomy query operator?
- a-z list, categories and sub categories in loop
- Is it possible to select and edit the way the most recent post from a certain category is displayed on the page?
- Displaying multiple loops based off of category
- How to loop only categories without posts (+ show category featured image with acf) [closed]
- Additional featured post on first page
- Show all posts for a specific category/author
- Redirect category to url with /category
- create a page which displays a list of categories title+ short description?
- Post count for category and tag
- Enter a variable in the ‘category_name’ parameter
- How to query post like normal search would do. within search.php page
- How do I call posts with a certain tag?
- Show a Category X’s custom post type on Category X archive page?
- Modify WordPress SQL Query to pull from within a category
- Remove product category placeholder image (Woocomerce)
- WooCommerce – How to show specific category first-rest of products-specific category last
- List posts in alphabetical order
- Inside a loop, how to change CSS class based on category name?
- Exclude current post from loop
- How to insert category list into post creation page, and retrieve chosen categories?
- Categories list loop – add separator every 3 categories [closed]
- Randomly load categories with latest post
- Set colors depending on category
- List all posts in a category with query_post() function
- Exclude a category from a query that includes its parent category
- Show the latest post from child category?
- Trying to get variables in hacked category dropdown
- category__not_in and id values from variable
- Do not show sub categories in the loop on archive-product.php
- Insert HTML content in WP Query at specific point
- Posts from a category on homepage with category archieves page default css
- Simple way to style posts of a single category differently in the loop and in single
- Have posts that belong to multiple categories, exclude some categories from homepage
- Show multiple categories in query using redux framework variable
- Get the ID of the current post’s child category
- Limit Loop to One Category
- wordpress taxonomy query posts
- Display post thumbnail for specific category outside the loop
- PHP dynamical conditional post display
- Posts of specific category on page and excluded from index.htm
- new WP_Query issues
- the_category() doesn’t working in wp_query loop
- Conditional category query breaking?
- Displaying links to all posts of the same category on the post page
- Post not found when filtered by category ID
- Category sticky latest
- Show posts from category specified using a custom field
- Add class to current post in query_post
- Exclude posts without category from loop
- Show the number of the post
- How can I order all subcategories alphabetical independent of the parent categories?
- Custom Loop with certain number of one category
- How to create a category loop on my blog (ACF Plugin)
- Pagination does not work with query_posts()
- Displaying Category in sidebar post widget but not in the loop on home
- How to display products with multiple conditions, product_id and category_id
- Querying posts from two different categories while looping inside another loop
- Trying to display all posts in a category
- Loop doesn’t work
- Display Taxonomies in loop with template args
- How to loop through a custom field for each post, & display?
- Query post only from categories that have subcategories
- show category name before first posts in each category
- Loop through posts of CatA and store value of CatB in separate array
- How to add an empty entry to masonry?
- How to get multiple loop in category.php, my scripts becomes madness
- Category slug in in loop always the same?
- how to get number of posts in a category on a specific date
- Show posted on date only for posts in a certain category
- 2 loops in archive.php (one for each category)
- Displaying posts by year
- Paginate WordPress Category Pages
- single.php fires more than once after clicking on any post to view with different post id each time
- Using pagination with multiple loops causes it to break
- How to create a custom loop ordered by Categories on a Page Template?
- Order Categories by Character Count