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 Dynamically Filter Custom Post Types by Taxonomy Based on URL in Elementor Pro and ACF?
- How to correctly edit permalink structures for both default and custom posts/taxonomies?
- How to create custom url structure based on custom post type rewrite slug, taxonomy and category slug?
- How do I display the taxonomy term alongside the post type post title?
- Display custom post type category, while in a CPT category, then the posts beneath
- Rewrite Question Mark in Post Template to Make it Pretty URL
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- Display Custom Toxonomy In WordPress and theme Widgets category selection dropdown list
- Hide parent categories when clicked, and show it’s childs
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- Hide post navigation if current post is in a category with only one post
- Get related posts of child term of custom post type
- Limit amount of posts made within a custom taxonomy
- custom-taxonomy/post_name instead of the default post_type/post_name
- Filter term taxonomy metabox in custom post type
- Show custom post archive when custom post not specified
- Show custom post type relationships by taxonomy
- Group CPT posts by custom taxonomy
- Issue on Creating Custom Tax Term Dynamically From Another CPT Meta-box On Publish
- Filter CPT posts by one or more categories
- Custom taxonomy and custom post type – wrong permalinks and template
- Setting up taxonomy to relate various custom post types – advice on structuring?
- Getting categories of posts under a custom taxonomy
- Post count by month of taxonmy term
- How can I make the slug of the taxonomy also the slug of the custom post
- Query taxonomy of taxonomy of custom post type
- Taxonomies don’t show up on in the dashboard page for a custom post type in wordpress 5.22
- Can’t remove front from permalinks for custom taxonomy category page
- Changing the search url according to language
- Custom WP Query on custom meta and sort by multiple meta keys value
- How to checked selected category checkbox when my custom post inserted from frontend
- Allow duplicate slugs for custom post type with taxonomies
- list taxonomies from a custom post type
- How to display Custom Taxonomy under Custom Admin Menu?
- Display a grid of taxonomy terms at root taxonomy page
- WordPress custom taxonomy, posts urls
- Listing posts under primary and secondary taxonomies