0
votes

I'm implementing a wordpress website and there are lot of categories has been created on admin panel. But I don't want to display the categories in the menu which does not have any post assigned to them.

Is it possible to add a bit of code to hide the categories in the menu that don't have posts assigned to them? If yes, could anybody help me to get the solution?

Thanks in advance!

2
You shoud post some code showing what you have already tried.ste-fu

2 Answers

1
votes

If i understand your question correct you are trying to do something like this:

$args = array(
'hide_empty' => 1,
);
wp_list_categories( $args ); 

hide_empty will hide categories that has no posts attached to them.

0
votes

"Category Posts in Custom Menu" this wordpress extension helped me to get the solution

Link : https://wordpress.org/plugins/category-posts-in-custom-menu/