I’m writing a filter plugin that will filter the list of categories in the sidebar, to show only categories with posts that has a certain custom field. It’s my first plugin.
I understand I can’t filter the output from the wp_list_categories() function in the template, since it’s mixed with HTML. But that function calls get_categories(), which has the following hook:
$taxonomy = apply_filters( ‘get_categories_taxonomy’, ‘category’, $args );
The ‘get_categories_taxonomy’ filter hook is undocumented. The docs mention a filter hook named ‘get_categories’, but it doesn’t exist in the code. And the get categories() function is supposed to return an array of category objects, but there is no Category class…
So, in the absence of proper docs, I must ask for assistance. 🙂 How would you approach this task?
- The topic ‘Filter categories on custom fields?’ is closed to new replies.