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
- WordPress converting ‘ to ’ and – to –?
- Get the Current Page Number
- Including categories in search results
- Query posts from current year
- Convert IPTC keywords to blog post tags
- Can I change a post to a page by changing it’s type?
- Add a custom option to a page in backend
- Populating a page with content from post custom fields
- Do I use custom post type or something else?
- Limit function to specific post category
- Show all post titles
- Posts are not showing up on particular category
- how to programmatically change post tags
- Can a page_id and a post_id be same?
- Getting a 404 error when clicking edit page
- How to display related posts by subcategory and not parent category
- Category Template: Need to display different content on first page of archives
- Extracting post categories
- How to limit posts by category
- Related posts by category not working right
- How to add tags (custom taxonomy) to post class css?
- How to Mysql select a list of posts with meta_values AND all relevant categories?
- get_the_category listing in hierarchial order
- 2 dynamic sidebars registered, not showing up
- How to make default “Privacy Policy Page” a normal page?
- How can I display tags as categories?
- Post-Archive like a page in a specific subdirectory
- How to display only one category in a custom post type?
- Get only X number of categories
- inserting a category into post
- Getting posts from some categories plus some individual posts
- Change layout of post depending on category
- latest post showing up twice on posts page
- wp_list_categories() Exclude All Categories Except One
- Direct some posts to only appear on a specific page
- Possible?! A contextually titled back link
- How do you change the permalink for posts for a single category?
- Exclude posts in a category on one page but show those posts on a different page
- Excluding category from post navigation in WordPress?
- Querying posts from current category, using a variable as array argument
- Need help writing loop to display posts by categories in separate divs
- Add category selection to function request
- Query post category & remove any post id
- Converting Posts to Pages
- Multiple Post Repeat for Related Post Loop by Category
- 404 error on every post and page other than home
- how to show posts on different pages if number of post per page is one
- Output posts with same name as tags?
- The next_posts_link() works only with original $wp_query
- Is it possible to have different header style blog titles in different categories?
- Category pages vs single post pages
- How do we display a certain category type on a page while hiding all others?
- How to make posts appear under pages
- Header and Footer options in pages and posts
- How to get a list of all posts and their categories?
- Mismatch between posts count and actual list in admin posts page