This works for me:
function namespace_add_custom_types( $query ) {
if( is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
$query->set( 'post_type', array(
'YOUR_CUSTOM_POST_TYPE', 'nav_menu_item'));
return $query;
}
}
add_filter( 'pre_get_posts', 'namespace_add_custom_types' );
Related Posts:
- Custom Post Type Archives by Date and Taxonomy
- Custom post types – Use post_id in permalink structure when using has_archive => true
- Meta_Query as a way how to setup CPT permalinks – is it a good thing?
- Taxonomy count per Post type
- How do I display two separate taxonomy archives for two post types that share a single taxonomy?
- Archive page with multiple taxonomies rewrite
- show tags of custom post type ONLY
- Create permalink structure for one taxonomy archive per custom post type
- Taxonomy archives based on Custom Post Type
- Taxonomy page returns 404 page not found
- How would I leverage custom Taxonomies in this scenario?
- Custom post type tag archives don’t work for basic loop?
- Removing CPT slug from URL results in 404 error for archive page
- Regex problem in an add_rewrite_rule
- Rewrite custom post & taxonomy to share same URL path
- How do I list terms of a custom taxonomy at i.e. domain.com/brands/
- Custom post type with tags
- Registering tags taxonomy for a custom post type
- Is slug “type” reserved and can’t be used in taxonomy rewrite?
- get_categories for custom post type and filter by custom taxonomy (brand) and list child categories of a defined category
- Permalinks for Taxonomy and Custom Post Type
- Category page only displaying the posts from a custom type
- How to list custom post types?
- custom taxonomy archive by year
- How to make a custom taxonomy selectable in post publish area?
- Conditional regex in add_rewrite_rule() for specific query filters & pagination
- Hierarchical Custom Post Types – Show only parent on tax archive?
- How can I display an archive of only one category of my custom post type?
- Change Permalink Structure for Tag.php template
- Why does querying on post_tags (which has been applied to custom post types) only return posts?
- CPT Archive with core Category
- Tag page with Custom Post Types not returning any posts
- Tag Archive for Custom-Post-Type Posts yielding 404 when permalinks set to postname
- Taxonomy custom post type URL
- How to build custom route by adding taxonomies to URL ? ex: www.demo.com/communities/palo-alto/
- Set a CPT slug as a base name for all the taxonomies
- How do I check if the user is on a taxonomy term parent, child or grandchild page?
- How to get list of taxonomy slugs ordered parents>childs?
- Taxonomy in URL
- Best way to specify “article type” in URL
- How can I create an automatic drop down menu with my tags?
- Need help deciding on a taxonomy
- Get Posts by Category, Tag , and CPT Taxonomy
- Use the custom post type archive for taxonomies?
- How to rewrite custom taxonomy term archive to use THE SAME SLUG/front as CPT
- Archive page for custom post type and custom taxonomy
- Why does my URL keep returning 404 error code?
- Custom post type, taxonomy and admin bar
- Advanced archive url structure (category, tag and date)
- Custom Post Type Date Based Archive URL rewrite [duplicate]
- Define multiple prefixes for custom post type
- Custom permalink structure for custom post types including multiple taxonomy
- get taxonomies from terms
- Custom post types not showing on the standard WordPress Category page
- Archive for custom taxonomy
- Automatically / dynamically populating tags in custom post type
- One of my headings is mysteriously coming up as a link in my CPT Archive
- Rewrite url post_tag for custom post type
- Custom Post Type tag taxonomy “Page Not Found”
- Default taxonomy ‘post_tag’ added to CPT managing by custom role : nothing in the metabox
- Taxonomy count per Post type
- Archive.php is not displaying tags
- How can I set up the URL for a category archive for a custom post type?
- Generate daily archive whenever any post type is added
- custom post type tags
- Show custom category archive as front page and remove taxonomy slug from urls
- Get custom post type slug for an archive page
- How to pass URL parameters for advanced taxonomy queries with multiple terms for one custom taxonomy
- How to limit the number of terms (terms acts like categories)
- Custom Post Type – Taxonomy Dropdown Menu?
- How can I list all the categories under a Custom Post Type (taxonomy)?
- Filtering Posts by Multiple Taxonomy Terms such as in an Admin Post Listing?
- Slug for custom post type archive
- How do I display custom post types through a common taxonomy?
- Paginate_links won’t create the right links on a taxonomy filtered custom post type archive
- Permalinks when filtering multiple custom post types by single taxonomy
- Query Multiple Taxominies Across Multiple Post type’s
- Does anyone have a plugin that could automatically tag custom post types in wordpress?
- Displaying Posts of a Custom Type
- Relative URLs for a particular custom post type?
- Custom post types and tag archive pages/permalink structure issue
- How can we take into account post types when constructing permalinks?
- WordPress showing archive.php instead page
- WordPress uses url different from defined in rewrite arg of custom post type
- Rewrite rule for Custom Post Type Page as a parent
- Linking from CPT page to taxonomy.php
- Page not found for custom post type UI plugin and taxonomy
- Assign CPT archive page attributes
- Add term slug in URL of custom post type details page
- add custom tags for custom post type in wordpress
- Custom Post Type URL Rewrite’s
- How to apply multiple rewrite_rule to a single custom post type url?
- Custom taxonomy named ‘tag’ return 404 page
- How to get current post type?
- How to convert Post Object Custom Field into Tags
- Wrap an X amount of taxonomy posts in a separate Row in WordPress
- How Can a CPT in WordPress have a page 2 without an error?
- Rewriting archive page slug to be different than custom post type slug
- Site loads very slow for archive custom post type page
- Parent cpt/child custom post type URL permalink relationship