Have you tried using a normal loop in your tag template like this
<?php while ( have_posts() ) : the_post() ?>
//add content code or template
<?php endwhile; ?>
And then using the pre_get_posts
filter like this
function exclude_category( $query ) {
if ( $query->is_tag() && $query->is_main_query() ) {
$query->set( 'cat', '-433' );
}
}
add_action( 'pre_get_posts', 'exclude_category' );
Related Posts:
- Exclude a category from the filed under list only on some templates
- exclude category from get_posts?
- Preventing index.php?category_name=something from redirecting
- Make all subcategories use the template of its category parent?
- Exclude certain category from latest updates
- List posts by category exclude current post
- Different templates for parent and children categories/taxonomies
- Excluding a category from next and previous post links
- Exclude Category From Home Page, Display Posts on It’s Own Page?
- Display only deepest category on a single post?
- How do I set a specific template for sub-categories?
- How to exclude categories from recent posts, recent comments & category widgets?
- is_archive() content being shown instead of is_category()
- How to override Category rendering mechanism
- How to control template resolution if both Author and Category filter in place?
- Which php file lists all the post of a category
- Apply custom category template to subcategories
- Custom page for WooCommerce’s /product-category/
- Code to pull in a PHP file named after the category ID
- How to make a Thumbnails Mosaic
- Are Category or Tag Archive Pages Possible?
- Possible to make a subdirectory that loops through a single category?
- Need Category RSS Feed that shows all posts
- WooCommerce IF statements not working
- I need to create a search form that will display search results from specific category
- Set a them for all subset of category
- How to display only posts assigned to a particular, isolated, subcategory
- Highlight wp_nav_menu when category is selected
- Query Posts Exclude Entire Category
- Archive.php filtered by pre-determined category
- exclude categories from search results
- one category template for multiple categories
- Different templates for different category tags
- WordPress category widget only show categories with children
- The default code for “posts_nav_link” on category.php isn’t working
- Only one post is showing on category page, why?
- Categories overview that links to page displaying posts
- How can I get categories IDs if multiple categories requested via URI?
- Does “show_option_all” in wp_list_categories do anything?
- How can I improve this taxonomy treating approach?
- How to insert category list into post creation page, and retrieve chosen categories?
- wp_list_pages() exclude category
- Exclude category from query
- Functions.php: Exclude Category from “Blog”
- Custom template for sub-sub-categories
- What Must to Display the “mysite.com/category” URL?
- Woocommerce filter function not updating
- Using if statement in index.php instead of creating separate template files
- Why is my sub-category template showing the wrong posts
- Template for product-category page [closed]
- Have posts that belong to multiple categories, exclude some categories from homepage
- Exclude all subcategories in the_category (post)
- Display subcategories selectbox on each category page
- I need to exclude from a query a category and a few custom taxonomies
- Exclude categories by ID
- Displaying year once in category.php [duplicate]
- Category link redirect to custom template page instead of index.php?
- How to differentiate the homepage structure from the category page structure in WordPress template?
- How can I include custom category and tag base in template files?
- Category Template – Show Last Entry as Featured
- How can I exclude a category from the main loop with the category name & not ID?
- Include home page template in specific category template
- User level categories
- Exclude category from drop down list form
- Output Title of Post’s Current Category
- Showing different posts on category pages
- Displaying categories in different template problem
- exclude certain categories form archive widget
- How to list posts from a sub-category that is listed in a parent category (more details below)?
- How to remove an item from a custom Walker_Nav_Menu
- Custom Archive Template for Multiple Categories
- How can I exclude a particular category from my WordPress Page 1 and Page 2?
- Category custom template is not showing correct posts
- Exclude category from WP_Query args not working
- Displaying Category in sidebar post widget but not in the loop on home
- Using a template page parent breaks page
- the_content() not showing full posts in category template
- Use different file includes for single.php
- Choosing different templates for categories
- Show posts from all categories
- Getting page/category content to show up in my custom page template
- Most efficient way to have 1 template for parent, 1 template for child categories?
- Category menu that filters out empty categories
- Category Templates for Post Types not Working
- One category not displaying template updates
- WordPress a template for subcategories fo a given category, but not for root category
- How do I get a single page navigation depending on the previous page?
- Problems with explode [closed]
- Exclude Category From Home Page, Display Posts on It’s Own Page?
- Add 1 category more to If_in_category statement
- How to have a category not show up in query post with page panigation?
- Custom Fields to Category edit page, then displaying them in a template correctly
- Category Template – to be editable from the backend?
- Call function on a single page
- 2 Categories using same template but one has a problem? [closed]
- have_posts is empty on category.php
- Why does my category page display “posted on…” when all I want it to do is display categories?
- How to create a template for categories
- How to load/include category templates based on conditionals?
- How to define category ID in an array?