Not sure about the custom taxonomy, however I have used this code before to remove empty categories. You can add it to functions.php.
add_filter( 'wp_get_nav_menu_items', 'nav_remove_empty_category_menu_item', 10, 3 );
function nav_remove_empty_category_menu_item ( $items, $menu, $args ) {
global $wpdb;
$nopost = $wpdb->get_col( "SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE count = 0" );
foreach ( $items as $key => $item ) {
if ( ( 'taxonomy' == $item->type ) && ( in_array( $item->object_id, $nopost ) ) ) {
unset( $items[$key] );
}
}
return $items;
}
Related Posts:
- How to display submenus on page based on referring top-level parent?
- Remove pagination from WooCommerce product categories on admin edit navigation menus
- Taxonomy , subtaxonomy,child taxonomy of a product woocommerce
- Programatically added attribute, set to ‘show on product page’ automatically. Woocommerce [closed]
- Get custom category image from menu
- How to add Post Format Taxonomy Archive page in the menu?
- How to get all taxonomies which can be added in menu?
- woocommerce custom product category template
- Corrupted nav-menu?
- Fill New Taxonomies
- Cloning product not copying custom taxonomies
- How to add all existing Custom Taxonomy to Admin Menu Creations Interface?
- How do you search for a post by custom taxonomy?
- What is the current page’s Taxonomy?
- Display woocommerce product_cat child terms with thumbnails
- How do I check if a post has a term with a particular ancestor/parent?
- How to use taxonomies on attachments with the new Media Library?
- Add custom taxonomy fields when creating a new taxonomy
- How to display custom taxonomies in posts?
- Creating Custom Taxonomy without mapping to any post type
- Exclude specific slug in ‘get_terms’
- wp_insert_term – parent & child problem
- Widget to display custom taxonomy tag cloud
- Hook to process a new taxonomy tag before it is created?
- Multiple users – only allow them to manage their own terms for custom taxonomy when logged in
- Custom taxonomy position in admin panel
- wp_options table value
- Custom Taxonomy Only Showing Top Level Terms in Admin?
- Is it possible to get a Previous/Next Taxonomy term archive URL?
- How do I display a tag cloud with both post tags AND a custom taxonomy?
- Adding session variable and/or cookie based on user-selected input
- How to display term description in empty terms archive?
- Create Child Taxonomies
- Query Posts by taxonomy/Taxonomy Child Custom order
- Get child product categories from parent product category in WooCommerce
- Current category link filter
- display taxonomy slug from term ID
- Make a taxonomy column sortable in the admin?
- Redirect all child taxonomy to its parent
- Woocommerce product search result layout page
- Woocommerce: How to change the add to cart text in a certain category? [closed]
- How to display custom taxonomy images on index.php?
- How do I taxonomy terms based on terms they are used alongside?
- get_term and get_term_by return null or false, even though term exists
- How can I populate a select element with terms from a custom taxonomy and filter post results?
- How do I list the pages of a custom taxonomy?
- has_term if/echo else/echo function
- Get number of post who belongs in two taxonomies!
- How to target parent product category and its children using WooCommerce?
- Query posts by taxonomy with current term
- WordPress thinks my custom taxonomy pages are search pages #seo
- Getting WooCommerce product related child categories
- problem in taxonomy-{taxonomy}.php pagination
- Adding custom taxonomy in my existing category URL
- How to get posts which must match both custom taxonomies?
- How to add images to taxonomy terms? [duplicate]
- Why get_page_template() doesn’t show taxonomy template file name?
- How can I create an automatic drop down menu with my tags?
- one post per term taxonomy
- How can I change the output display of my pagination?
- Hide custom Woocommerce taxonomies when empty
- How to get attached image to taxonomy..?
- How to get list of only custom taxonomies?
- How can I get Taxonomy Images to work with ‘orderby’ argument?
- Can I output a custom taxonomy as a submenu in the site navigation menu?
- Use wp_list_categories to list parent categories from actual term
- Amend taxonomy to search in wordpress admin
- Unique taxonomy for post
- Trash Bin for Categories?
- How to add a dynamic dropdown derived from custom taxonomy
- Retrieve the child terms by having the parent’s information
- add pagination in wordpress page template
- How to add all subcategories as submenu in WordPress menu
- How to create a non removable taxonomy term?
- Custom dropdown list taxonomy not saved
- How to show category list in WordPress
- Get post meta value outside of the loop
- Unable to create a new taxonomy
- Change link of taxonomy when get_the_term_list( is used?
- transfer two existing taxonomy terms into one custom metabox
- Custom taxonomy shows full articles
- Why get_terms() behaves strangely when being called in admin (for use in meta box)?
- qtranslate-x problem with custom term description
- Templates files for custom post type with custom tags
- Creating a Taxonomy Page [duplicate]
- Change order custom taxonomy
- Looking for suggestions on creating simple database (Help!!)
- Extra fields on categories that is available via the WP-API?
- Custom taxonomy – query returns an error
- Register custom taxonomy from a Advenced custom field option page
- List of taxonomy archive index page links
- Get Posts with matching lowest taxonomies
- Any way to make custom taxonomy field searchable?
- query posts returns 10 records
- Insert taxonomy term to different table
- Getting taxonomies specific to categories
- Remove Tag Cloud Words from Custom Taxonomy
- How to add/enqueue Custom CSS for a custom taxonomy page?
- Add custom display condition to Elementor Theme Builder for custom taxonomy children, grandchildren, and great-grandchildren
- Add text in custom taxonomy