I'm developing a theme that uses the get_the_category_list() function (in category-template.php).

Examining its code, this function calls the get_the_category() function (in category-template.php) which applies the get_the_categories filter at the end:

return apply_filters( 'get_the_categories', $categories );

For some strange reason, this filter returns an empty array. If I replace this line with:

return $categories;

then everything is ok.

Any ideas about what's happening here?


Changes occur when a filter is applied, but's that's not where the rules for the alteration originate from.

Either your theme or a plugin you are using must be hooking into that filter and be adding a callback function/method, that is responsible for the $categories array being emptied.

Deactivate all plugins, switch to a standard theme. Things should be back to normal. Reactivate everything one by one and find the culprit.


cd /path/to/wordpress/wp-content/plugins/ && grep -r 'get_the_categories' .

from a *nix shell should also help you find it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.