categories

2 minutes read
Recently, one of our readers asked how you can exclude categories from the navigation menu on the fly if there are no entries in the category. In this article we will show how to implement our plans. For this solution we will use the wp_get_nav_menu_items filter and the global $ wpdb object [ codex ]. They will help us remove empty terms from any taxonomies. The wp_get_nav_menu_items filter is applied to the array of menu items in the wp_get_nav_menu_items () [ codex ] func...