I had to modify queries before they run. So the best practice was to add the following code to function.php:
if (!function_exists('my_theme_filter')) {
function my_theme_filter( $query ){
if ( $query->is_main_query() )
if ( $query->get( 'tag' ) OR is_search() )
$query->set( 'post_type', array( 'artprim_item' ) );
//echo '<pre>'; print_r($query); echo '</pre>';
return $query;
}}
add_filter( 'pre_get_posts', 'my_theme_filter' );
-
if ( is_search() )was necessary for taxonomy, this is what made this URL works :http://website.com/tax_groups/a_random_group/
It’s surprising and made me lost a lot of time since the search by itself was already working just fine
-
if ( $query->get( 'tag' ) )obviously was necessary for
Related Posts:
- List all the tags from a custom post type
- Find callback function for custom taxonomy metabox
- WordPress Custom Post Type Category Page
- Best Way to Leverage Custom Post Type Related Content and Consider SEO
- Show certain terms from custom taxonomy but exclude ‘parent’ terms?
- Pagination throws 404
- How to search from specific post type with tags?
- associate custom post type with tags with specific pages
- Is it possible to make tag archive page specific to Custom Post Type?
- Custom Taxonomy – Tags Metabox is showing instead of Categories
- How to make a custom taxonomy selectable in post publish area?
- Add Tags to custom post type
- Can custom taxonomies items have attached properties?
- Change Permalink Structure for Tag.php template
- search also in taxonomy, tags and custom fields
- Custom Post Types, URL rewrite on multiple CPTs
- Listing tags from a custom post type
- Get Taxonomy Term Title by it’s URL
- create a subcatagory for a custom post type and out put url as posttype/subcategory/item
- Taxonomy in URL
- Show all tags on custom post type
- Best way to specify “article type” in URL
- Display posts with tag for custom post type only
- How to list tags from custom post type attachments?
- Why does my taxonomy have a category style div id?
- portfolio custom type tags support
- How can I create an automatic drop down menu with my tags?
- display custom taxonomies limited to custom post type?
- The Difference Between Categories and Tags and Taxonomies and Terms
- Print all the tags from a custom post type
- add custom tags for custom post type in wordpress
- Custom Post Type URL Rewrite’s
- Advanced archive url structure (category, tag and date)
- how to achieve this permalink abc.com/CPTName/CustomPostTypeCategorySlug/categoryname
- Search CPT by tag ids
- URL for archive of custom post type with 2 taxonomy terms
- How to set “section categories”?
- Tags being removed upon updates to related posts: ACF/Genesis/WP5.4.1
- CPT tags not showing when editing post
- How to add independent “Tags” to Custom Post Type?
- Custom Post didn’t display on tags page
- Add tags to a “pending” post before publishing
- What am I doing wrong with my taxonomy?
- Custom Post Type tag taxonomy “Page Not Found”
- Do not output category and tag URLs
- Force WordPress to only match URL in category
- Organizing The Custom Post Type with Taxonomies / Parent Posts
- Loop multiple taxonomy in custom post
- Generating List of Tags from Custom Post Type
- Archive.php is not displaying tags
- WordPress Custom Post Type and sort by Tags
- Customize category URL
- Remove custom taxonomy ‘post-type’ from post URL
- Sorting custom post types by taxonomy (So close)
- get tags from custom post type
- Attaching multiple custom taxonomies to one CPT?
- Links in archive not including taxonomy parameter
- Custom Post Type with multiple Custom Taxonomies / Hide Taxonomy Slug from URL
- Hide custom post type slug url from search engine [closed]
- Custom post type with custom taxonomies structure url not working archive of CPT
- Is it possible to use a post name in a custom post slug?
- ACF – Tags not showing up in Custom Post Types
- Search for portfolio tags & mixing portfoliotags and post tags
- How to correctly edit permalink structures for both default and custom posts/taxonomies?
- How to Make a Separate RSS Feed for Each Custom Post Type
- Registering custom taxonomy with unique name, a good practise?
- custom post type and custom taxonomy permalink
- get_query_var() not working in pre_get_posts
- When we register a custom taxonomy or post type, does the WP database modified at all?
- Dynamic taxonomy in permalink made all other posts NOT FOUND?
- How do I create multiple post types in same menu section in WP-admin?
- Custom Post Type Archive URL takes over page URL
- How to Add Pages Under Custom Post Type URL Structure?
- WordPress Search documentation: how to improve search query using taxonomy terms, custom meta fields?
- custom post type taxonomies UI radiobuttons not checkboxes
- Custom Post Type Archive Template
- Order posts by (hierarchical custom) taxonomy terms and term children
- Filter get_categories() for taxonomy term in WordPress
- Custom search for custom post type, custom meta and search fields
- Adding An Author Tag To Posts Automatically
- Add the .html extension to custom post types
- After deleting a post are terms, and custom meta deleted?
- Show metabox in custom-post-template depending on taxonomy term?
- Custom Permalink for Taxonimie and Custom Post Type
- Adding the taxonomy before the custom post type
- Menu Multiple Taxonomies
- Custom Taxonomy term archive template
- how can i get posts from custom post type particular taxonomy category
- Permalink Structure CPT With Custom Taxonomy Fails
- Conditionally custom post type url rewrite
- How do I create filters for custom post types?
- Root slug of taxonomy returning 404
- Multiple portfolios and single item in two of them (ideas?)
- Pagination for Custom Taxonomy Page [duplicate]
- Display custom post type category, while in a CPT category, then the posts beneath
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- Hide post navigation if current post is in a category with only one post
- I want to change the word “Tags” in WordPress to something else, but how?
- How to have this permalink structure: post_type/postname/custom_inner_page
- Set post terms for multiple posts