You can use pre_get_posts
filter hook to set the post type passed by the user:
paste this code in your theme’s functions.php file:
function user_set_type( $query ) {
//only on your taxonomy page
if ( $query->is_tax('YOUR_CUSTOM_TAXONOMY') ) {
//and only if the guesst has selected a type
if (isset($_GET['UTYPE']) && !empty($_GET['UTYPE'])){
$query->set( 'post_type', $_GET['UTYPE'] );
}
}
return $query;
}
add_filter( 'pre_get_posts', 'user_set_type' );
Change YOUR_CUSTOM_TAXONOMY
to the name of your taxonomy, then on your taxonomy page or widgets all you need to do is create links with the post_type as parameters in them eg:
<a href="https://wordpress.stackexchange.com/questions/19524/<?php echo get_permalink() ."?UTYPE=designer"; ?>">Designers</a> - <a href="https://wordpress.stackexchange.com/questions/19524/<?php echo get_permalink() ."?UTYPE=boutique" ?>">Boutiques</a>
Related Posts:
- Get The Post Type A Taxonomy Is Attached To
- Shouldn’t this be easy?! Custom post type/custom taxonomy permalink
- Custom Post type & Taxonomy URL structure
- How to pass URL parameters for advanced taxonomy queries with multiple terms for one custom taxonomy
- Combining Multiple Taxonomies in one URL
- Getting the Intersection of Two Custom Taxonomy Terms for a Custom Post Type?
- How can I list all the categories under a Custom Post Type (taxonomy)?
- Two Custom Post Types, Share Two Taxonomies
- ‘No pages found’ in Dashboard after registering custom taxonomy
- Querying Posts by Taxonomy From Alternate Network Site
- How to display recent posts added in custom post types
- Should unaltered default loop/query return a list of custom posts belonging to a custom taxonomy?
- Creating a function that receives the taxonomy terms that have been changed in a custom post type
- Permalinks when filtering multiple custom post types by single taxonomy
- Filter custom post type archive page with custom taxonomies (categories) with AJAX
- How-to leverage WordPress for creating Extended Social Profiles
- How can I filter by taxonomy on a custom post type’s page?
- How To Create A Custom Taxonomy 404 Page
- How to Get Current Custom Post Type Selected Taxonomy Term (Not All Terms)
- Query Multiple Taxominies Across Multiple Post type’s
- Custom Taxonomy URL are redirecting to page with the same name
- Custom Post hierarchical to custom taxonomy
- Loop custom taxonomy to get lists of cutom post types?
- Hierarchical Custom Post Types in Array
- Making certain categories of CPT not publicly queryable
- Conditional Query of Custom Post Type and custom taxonomy
- Is $object_type truly required with register_taxonomy()?
- Show a Category X’s custom post type on Category X archive page?
- Specific query for custom post type
- Custom taxonomies relationship
- Suggested Post and Taxonomy structure
- Display post content with respect to its title?
- Use custom walker to add taxonomy terms to main nav menu
- WP_Query orderby and tax_query
- Custom Taxonomy not being saved on custom posttype
- Show fields based on taxonomy selection in editor
- Permalinks: custom structure for taxonomy – tags?
- Get parent category id from child category page for custom taxonomy
- Creating custom post type with custom taxonomy and custom fields programatically
- How to get only child terms from a custom taxonomy of current post type?
- Disable custom taxonomy on admin bar
- How can I create an automatic drop down menu with my tags?
- how to show records that don’t have custom meta value
- how to get this tax_query working?
- How to see posts in taxonomy endpoint
- Get taxonomy singular name instead of taxonomy slug inside $taxonomy query
- sort CPT on Custom Taxonomy Archive page
- Add term slug in URL of custom post type details page
- Cannot choose custom categories for custom post type in post editor
- Custom post type and custom taxonomy 404 on page 2
- Ideas on how to organize a project [closed]
- How should I structure complex content hierarchies?
- Querying two different post types with the same taxonomony
- Arduous WordPress Custom Post Type Permalink Path
- Modifying rewrite rules to use /category//
- Convert Custom Taxonomy Posts to Normal Posts
- Custom Post type Query by Taxonomy
- Order custom posts by taxonomy, then by meta_key
- Safe to throw 404 error in request filter?
- Using get_terms() to list terms from one custom taxonomy AND from one specific built-in category
- Auto Generate Post Title from 2 Custom Fields
- How do I make a request in my browser to search the CPT taxonomy?
- Archive page of taxonomy returns a 404 error
- i want to send email to user when the custom taxonomy is changed
- Issues with static pages redirecting towards home.php
- Custom post type template – add banner under heading
- Get dropdown child categories from parent category of custom post type
- How do you create pillar content pages?
- Custom post type single page returning 404 error when sharing archive url with custom taxonomy
- I want to create a metabox under custom taxonomy
- Grid slider with custom post type (how to filter with taxonomies?)
- CPT/Taxonomy/Postname permalink structure makes pagination break
- Set different posts_per_page for custom post type/taxonomy
- Custom Taxonomy not working front side Woocommerce
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- Facing some Issues on Two Parts Custom Post Type Taxonomy Names
- I want to create an archive and single page for a custom taxonomy for a custom post type
- Change the url of a custom post type to include taxonomy
- Creating adminable dynamic filtering on custom post type
- Complex strcuture as CPT or taxonomy for use in woocommerce product variations [closed]
- WP_Query for CPT with filter by another WP_Query
- Get posts in same category not working
- Heirarchical URLs with CPT and custom taxonomy
- Displaying taxonomies with manage_{custom-post-type}_posts_custom_column
- How to query posts by meta keys AND under specific category?
- Shortcode display CPT Query only showing 1 post?
- Permalinks when using Custom Post Type with static page for archive
- How to change permalinks to taxonomy and post type’s posts
- How to show a custom taxonomy using a custom template
- Get Registered Custom Post Type to get All Custom Taxonomies
- Parent cpt/child custom post type URL permalink relationship
- Query Only Show Text on Posts With Certain Taxonomy Tag
- Custom Taxonomy Showing in WP Menu
- How to make a single Menu Item call another Mega Menu for Custom Post Types and Custom Taxonomies?
- Display ONLY ONE $term (Out of 4 terms) from a Custom Taxonomy and CPT
- Links in archive not including taxonomy parameter
- How to add to taxonomies to a post type
- Filtering custom post types using category taxonomy
- How to use wp_set_object_terms depending on page ID?
- Permalinks for Custom Post Types and Taxonomies