How to hide a child category and show his parent category
This is what you want to achieve as I understand: If a post is assigned to a child category, then remove it and show only its parent on the categories list of that post. You can use the following code to achieve that for any child category: add_filter(‘get_the_terms’, function($terms, $postId, $taxonomy) { // Return early … Read more