The widget class uses wp_list_categories()
which supports all the parameters for get_terms()
like taxonomy
which you can use to make the widget lists categories in a taxonomy other than category
.
So your code would be:
add_filter('widget_categories_args', function( $params ) {
// $params['post_type'] = array('post', 'recipe'); // post_type is not a standard parameter for get_terms()
$params['taxonomy'] = 'recipe-categories';
return $params;
});
However, the widget only supports a single taxonomy because wp_list_categories()
uses taxonomy_exists()
which doesn’t support multiple taxonomies. Here’s the relevant code in wp_list_categories()
which causes the limitation:
if ( ! taxonomy_exists( $parsed_args['taxonomy'] ) ) {
return false;
}
So if you want to use multiple taxonomies, then you’d need a plugin for that (i.e. one that provides a similar widget) or you can code your own widget class.
Related Posts:
- How to build a complex page structure
- Help with Multi Level Category Archive Page
- Custom post type single-{custom}.php not working
- Filtering a custom post type by custom taxonomy in archive template
- Exclude a category from WP_Query
- How can I list all the categories under a Custom Post Type (taxonomy)?
- How to filter custom post types by custom category taxonomy
- Is there a way to use regular categories with custom post types?
- How to list all categories and tags in a page?
- remove support for ‘Categories’ for a custom post type
- Glossary with Custom Post Type
- Custom-Taxonomy as categories: Remove “most-used” tab?
- Filter get_categories() for taxonomy term in WordPress
- Template tags to display custom post type posts in category template?
- Add filter to wp_list_categories and query what type of taxonomy-terms it use?
- Custom edit post column – category not showing
- Taxonomy list. Order by a specific custom post type count
- How to show custom taxonomy in the permalink?
- Custom post type taxonomy template
- Custom/separate categories for custom post type
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- Taxonomy structure of Sport site
- Display Custom Category (taxonomy) Name in Custom Post Type
- get_categories() for only CPT
- Display types of posts in edit.php instead of All, Published, Scheduled and Draft
- Show Post Count of a Category
- Limit users by custom taxonomy and user roles
- custom taxonomy archive by year
- Generate Shortcodes by Taxonomy
- Get categories and descriptions from custom post type
- Custom Taxonomy – Tags Metabox is showing instead of Categories
- Combining custom post type and post category
- need advice on how to do a lists using custom post types – taxonomy vs postmeta
- Querying Term Posts in Loop
- How to create new category for custom post type?
- Weird problem happening with custom taxonmy when creating/updating posts
- How to Get Current Custom Post Type Selected Taxonomy Term (Not All Terms)
- Displaying a custom post types custom taxonomy value?
- Insert HTML inside link in a walker
- Custom Post Types and independent Categories – complex Taxonomy
- Should I use custom menu, C.P.T. or theme options, or something else for this?
- Should I use custom taxonomy or custom post type
- Set menu active state for custom posttype and category, given custom taxonomy term
- Display all posts in main category and 1 subcategory
- Custom Post Type Archive Page Filtering
- How can I auto-assign a CPT post to category in a custom taxonomy when published?
- What template files do I need to customise custom-category-term-links rather than fall back on archive.php?
- Posts from all the categories are being displayed instead of particular category
- Conditional Statement custom post type category
- Custom Post Type With Categories
- Categories sorting
- Allow user to set custom order to a list of custom taxonomies?
- get_category_parents for custom post type taxonomy
- wp_list_categories() – current-cat class also inside posts?
- Help need making decision. Ads rotating site on wordpress
- Categories of custom taxonomy don’t show any posts
- How to display custom taxonomies with links in filter menu?
- Show a Category X’s custom post type on Category X archive page?
- custom taxonamy and post type
- Return the latest post from a custom Taxonomy and Post Type
- Cannot add category or custom taxonomy from admin. WordPress site is hosted in Windows 16 server via IIS. No XAMPP or WAMP
- Don’t know how to show custom taxonomies from a custom post_type
- Hide parent categories when clicked, and show it’s childs
- Limit amount of posts made within a custom taxonomy
- Filter CPT posts by one or more categories
- Getting categories of posts under a custom taxonomy
- Help with Travel Guide Setup
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- Custom post types not displaying per category
- Custom post type category archive URL redirects to home page
- How To Display Category list from Portfolio post type plugin?
- Custom post type with custom taxonomy permalinks
- Dropdown switching subcategories portfolio
- Custom taxonomy page template
- Display custom Taxonomies same as listing Categories
- Organizing The Custom Post Type with Taxonomies / Parent Posts
- show custom taxonomies in hierarchy
- Display 2nd category, only once, as sub-heading, in the loop
- Post Editor: display categories from current post type taxonomy only?
- Get a list of categories ids
- Trying to create hierarchy between 3-4 custom post types
- Having some trouble properly displaying Custom Post Types in templates
- Customize category URL
- Category / Custom Post Type permalink issue
- How to Create Custom Post Type with Multiple Color Options?
- Display a custom post type list by taxonomy term
- Custom post type and custom taxonomy archive inaccessible
- Apply custom names for generic custom taxonomy name?
- Return Custom Post Type Categories
- Category names on CPT archive pages [closed]
- Remove slug from Custom Category Permalink + dual-category permalinks
- Highlight specific menu item when custom post is page
- Show custom post type on post category page doesn’t work / breaks navigation
- How can I show second most recent post in sidebar, if most recent post is open in the browser?
- Is it possible for post and custom post type to share a category base slug?
- How to add categories to a custom post type using wp_insert_post($new_post);
- WP Query filtering by custom category not showing all relevant posts
- How to get the proper category in permalink with custom post type assigned to multiple categories
- ACF Pro simple Business Directory – Requesting assistance with created Templates and associated Functions.php Coding
- Category display using conditions