In the navigation menu creation page, when you are trying to add a category to the menu, if the category is empty, it won't show up in the search results. However, if the category itself is empty but has a child that is not empty, it will still be shown.
I have a blog with over 500 categories, and I'm trying to add some of them to the menu but they have no posts yet. Navigating through category list is going to take time, and is also frustrating.
Now I've tracked down the issue to
/wp-admin/includes/nav-menu.php, ( starting at line 588 ) but can't find a filter or hook to do so.
This line (109) seems to be responsible for doing the search:
$terms = get_terms( $matches, array( 'name__like' => $query, 'number' => 10, ));
According to the documentations, this function accepts an argument for showing empty terms
'hide_empty' => false, but I can't see such option in this part of core's code. I've added this option to the core (temporarily) to see if it solves the issue, and it does.
Can this be a bug? And is it possible to enable the search to return the result no matter the category has a post or not?