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?
- Add category base to url in custom post type/taxonomy
- Display all posts in a custom post type, grouped by a custom taxonomy
- post count is wrong when using same taxonomy for 2 different CPT
- Issues when rewrite rules collide?
- Archive page for taxonomy of custom post type
- CPT tax slug conflict with post type slug
- Exclude current post when getting related post on custom post type and taxonomy
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- Custom post types, taxonomies, and permalinks
- How can I display my custom metaboxes on a custom post template?
- How to specify URLS for custom posts & taxonomies
- Search doesn’t find tags or categories in custom post types
- Taxonomy.php Not Showing Posts
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- Categories sorting
- WP_Query most viewed posts, in multiple Post Types, last 30 days, excluding a specific taxonomy term
- Allow user to set custom order to a list of custom taxonomies?
- Disable block with taxonomies at post page
- Add tag to a custom post type doesn’t change the total of custom post type in backend
- Sort and filter custom post type posts by custom taxonomy
- Terms showing up in object cache on unrelated pages
- Dynamically insert an article at the top of a taxonomy archive – or?
- Need help deciding on a taxonomy
- WordPress multisite – is it possible to have different taxonomies for each site?
- How to show list of taxonomy terms associated with specific post?
- I have custom post type with custom taxonomy. But not found the taxonomy page..
- Display Taxonomy Term Children in a Drop Down without Submit Button
- Custom taxonomy query showing more than 4 posts
- Help on Custom Post Types
- have to do a while have post to show for two custom post types sharing the same taxonomy?
- How to handle this wordpress custom post type rewrite problem?
- Is it possible to arrange Custom Post Types from CPTUI into a Folder?
- Issue with Custom Post Types and Permalinks
- Automatically Add a default category to a Custom Post Type before save_post action
- Custom post types with child taxonomy not visible in admin
- Filter By Term Not Working – Custom Post Type
- Listing custom post type items from a couple of custom taxonomies
- Show one of the taxonomies always as default
- From form submission values – dynamically update CPT “has_archive” slug and custom taxonomy “rewrite” slug value