Tag and Category archive queries default to querying only the post
post type, to add your custom post type to those queries, you can use the pre_get_posts
action:
function wpa_cpt_tags( $query ) {
if ( $query->is_tag() && $query->is_main_query() ) {
$query->set( 'post_type', array( 'post', 'object' ) );
}
}
add_action( 'pre_get_posts', 'wpa_cpt_tags' );
Related Posts:
- Widget to display custom taxonomy tag cloud
- Post tags saving as both tag name & tag ID on post update when tags are displayed as checkboxes
- How do I display a tag cloud with both post tags AND a custom taxonomy?
- WordPress renames slug of tags used in multiple taxonomies?
- Allow only 1 instance of each term in each custom taxonomy
- Extend & Search Native WordPress Image Galleries With Tags and Taxonomies?
- Replace taxonomy permalinks
- Create custom taxonomy and Display in metabox dropdown
- Set two terms for a post when they differ only by an accent
- Any way to make custom taxonomy field searchable?
- Group custom taxonomies based on tags contained in their posts
- Using wp_query is it possible to orderby taxonomy?
- How to use taxonomies on attachments with the new Media Library?
- How to remove the tag cloud from custom taxonomy admin page?
- How to add images to taxonomies?
- Can you add the visual editor to the description field for custom taxonomies?
- Check if a post has any term in this custom taxonomy?
- Custom columns on edit-tags.php main page
- Add custom taxonomy fields when creating a new taxonomy
- Contact Form 7 – Populate Select List With Taxonomy [closed]
- How to display custom taxonomies in posts?
- Get taxonomy names by post id
- Exclude Specific Term from Search
- Creating Custom Taxonomy without mapping to any post type
- Why is my working Custom Taxonomy not in get_taxonomies array?
- Custom taxonomy hide meta box but show in menu
- Can I turn off write-in tags/taxonomies?
- display posts with same taxonomy term
- Exclude specific slug in ‘get_terms’
- wp_insert_term – parent & child problem
- Is it possible to use one slug for Multiple Taxonomies?
- Is there a way to disable a term rather than deleting it?
- Modify Term Update Redirection
- Hook to process a new taxonomy tag before it is created?
- Return only the custom sub-term for custom post type, do not echo term-parent
- Get total number of comments from posts in a specific custom taxonomy
- Custom taxonomy on permalink
- Check if current term is a child of another term
- Custom hierarchal taxonomy loses interface hierarchy when selecting parent & children
- get_terms() doesn’t return empty terms even though hide_empty is false
- How do I filter posts by taxomony using AJAX
- SQL QUERY needed to get POST category (taxonomy) ? – MUST be SQL statement
- Remove Category description textarea
- Formating the_terms() function output
- Archive template for taxonomy terms
- Multiple users – only allow them to manage their own terms for custom taxonomy when logged in
- Custom taxonomy on users with UI
- How to return a list of custom taxonomy terms via the Gutenberg getEntityRecords method
- Create taxonomy with meta term using the WP Rest Api
- wp_options table value
- Custom Taxonomy Only Showing Top Level Terms in Admin?
- How can I set up a category “overview” page?
- Non-hierarchical custom taxonomy using checkboxes on edit-screen -> saving issue
- Sort posts by number of matched terms
- Get current term’s ID
- Is it possible to get a Previous/Next Taxonomy term archive URL?
- How to display and use all existing tags at my write-post-at-frontend-panel?
- Looping Through Custom Tax Terms and Displaying All Posts For Each
- Taxonomy Relationships
- Possible to register multiple custom taxonomies in one function?
- How to get the top most term (top ancestor) of a custom taxonomy child term?
- Taxonomies not appearing in columns on dashboard
- Combine multiple custom user taxonomy in single url
- How to modify default taxonomy field to a single text field?
- Add custom taxonomy to default category taxonomy?
- How to set hierarchical terms to a post using wp_set_object_terms
- how to get title to custom tags page
- Echo taxonomy term meta on author.php
- Hierarchical display of custom taxonomy
- Adding session variable and/or cookie based on user-selected input
- How to output the taxonomy term name in a widget
- How to link categories to custom taxonomy terms?
- List taxonomy / category count showing list published posts only
- How to display term description in empty terms archive?
- Can I turn off write-in tags/taxonomies?
- Advanced Tax Query
- Display sub-taxonomies based on SELECTED parent-taxonomy
- Checking if a Page has an Associated Term?
- Save Filter for Taxonomies
- What are terms and taxonomy, how they related to post and how these three are stored in database?
- Function to limit the number of posts in taxonomy.php
- Create Child Taxonomies
- Is It Possible To Have Shared WordPress Custom Post Types?
- Taxonomy , subtaxonomy,child taxonomy of a product woocommerce
- Get terms ordered by post date
- User role permissions based on taxonomies
- How do I make a custom taxomony appear like tags?
- WP Query with custom taxonomy
- Query Posts by taxonomy/Taxonomy Child Custom order
- How to prevent posts duplicating when viewing a custom taxonomy term
- How to display custom taxonomy in multiple columns?
- get_the_terms() to show all custom taxonomies
- How can I get WP to build a feed based on multiple taxonomy terms
- Custom taxonomies making WP very slow – Way to fix?
- Removing the “Popular Terms” area from the Taxonomy Edit Screen in the Admin Area
- get_terms: determine if taxonomy term has children
- Make tag cloud links consistent
- How to make a custom taxonomy selectable in post publish area?
- Change permalink of post if it belongs to custom taxonomy
- Sorting taxonomy columns by meta value numeric