Your cat_n_tag_archives()
function is adding pages to all category and tag results indiscriminately. What you probably want (and I am guessing a little) is to restrict that filter to the main query only:
function cat_n_tag_archives($wp_query) {
if (!$wp_query->is_main_query()) return; // This bit checks for the main query
$ary_one = array('post', 'page');
if ($wp_query->get('category_name') || $wp_query->get('cat'))
$wp_query->set('post_type', $ary_one);
if ($wp_query->get('tag'))
$wp_query->set( 'post_type', $ary_one );
}
Related Posts:
- Should I use posts or pages in this scenario?
- Display posts by tag on page
- Include related posts on a page
- Can I hide a specific post from latest posts page?
- What Defines What Category A Post Picks (if in multiple)
- How to show post(excerpt) from specific category on wp page?
- Can I divide the pages into categories?
- Using permalinks, category slugs, and tag slugs
- post categories
- Post categories to pages
- WP_Query: Mixing category__in and tag__in together
- How can I hide tags on a child-category page, if that tag has not been used?
- How to create a “latest news” page showing a list of posts from blog category
- How to get post with associated categories and tags names instead of ids with rest api?
- In what context should Categories and Tags be used
- Would a “hub” page work better as a page or a post?
- Are post, page and category IDs unique to each other?
- posts going to 2 pages/categories only show up in 1
- How can I add a page that shows posts from a single category?
- Different post views for different category views
- Can I show category name in url for only one of my categories?
- Automatic duplicate/copy of post to a related page in WordPress
- Is there a way to categorize a list posts all at once?
- How to get tags when using publish_post
- Yoast breadcrumb URL shows category instead of the page
- Remove status ‘archived’ from the default post and page view
- How to distinguish pages created by woocommerce?
- Why do I have categories with duplicate slugs?
- Display all tags even if they are not assigned to a post
- How to add a block to a category page?
- show only one category and filter by tag
- Page with Category Returning 1
- Post Category link is same with Page link
- How do I make it so that new posts within a certain category go into a certain page?
- Set multi posts random categories and tags
- Precedence of page permalinks over woocommerce product category links?
- Show only top 3 posts from 3 categories in order on home page
- Display only current page -> posts tags in page
- Displaying only posts from a certain category on my custom page template
- I need to create a page or post hierarchy
- how to style an individual page in a category [duplicate]
- CSS – Change height of Storefront / WooCommerce product categories, but not products
- wordpress category Description not allowed tag
- How to remove category and other tags from posts page
- How to get the number of posts in a selected category?
- Show related posts by category but ignore one category
- Create custom page in WooCommerce
- eBooks download website, page or post?
- Hide add new page button
- How To Keep Posts from Being Displayed Two or More Times on My Homepage? [closed]
- Divide Loop Into Days & Categories
- Different template for posts of all subcategories of category
- Add Post Tags to Body Class
- Mark menu item as current-menu-item for category
- Show posts on a page based on a category and tag(s)
- How to display category from recent posts?
- Post page to display specific category
- how to show single post in a custom template
- Start post pagination at 0 instead of 1
- Excluding posts not working
- Remove current category from post but display all others
- Why won’t pagination work?
- How do I include the category next to the title of a post?
- How to import nested categories from XML file?
- How to add some html formated text to every new post in WordPress
- Migrate posts from category and sub-category via SQL
- Posts Missing in Dashboard after update
- Posts and Pages: 404 Page not found
- How to get post with slug and exclude categories
- Make ‘blog’ page show content as well as posts underneath it
- How to compare post tags?
- Remove Featured Image from posts in specific category?
- Setting limit to posts or page creation
- Short link to read complete post
- Delete all Tag Links from Posts
- post/page content
- Post in bulk based on category template
- how to add tags to post in the Loop?
- Foreach issue in get_posts function
- Nestling Posts Under Page & Justify Text
- More Than 50K Categories and WordPress Admin Panel Stop Showing Categories and Posts
- Re-order Category Meta-data
- List Authors For Current Category
- List posts of assigned categories in list of all categories on single.php
- some posts being displayed as pages
- Assign specific ads to specific categories/posts
- Add tags to post before it’s created
- find posts with exactly 3/4 categories
- can’t post immediately
- Use radio buttons & checkboxes for post categories
- Where are my posts linked to? I keep getting a Not Found Error, and I have no single.php page
- List posts that are in the same category as the current post title
- Multiple blog “feeds” in a single blog each with distinctly styled post pages
- How to get pagination working with “Pending” Posts
- Custom post page has attributes of latest post [closed]
- Post’s arent displaying
- Show with echo if a post has two or more categories
- How to have 2 posting pages on a blog
- Can WordPress show posts based on a button that the user clicked 2 pages back?
- Sort Posts Alphabetically Based on Specific Category (Divi)