Help requested to hide a parent and child categories from the meta description in post archives

Hi all,

I have a lot of categories. Posts have multiple categories. I would like to hide 1 parent category called writers and all its children (which are the names of the writers) from the meta text in the post archives. So not hide the category, but hide the category and the subcategory of th category in the meta text.

I searched and found this: [https://stackoverflow.com/questions/70351852/how-to-hide-a-child-category-and-show-his-parent-category](https://stackoverflow.com/questions/70351852/how-to-hide-a-child-category-and-show-his-parent-category)

But that hides only the category I give the id of. And If i give the parent category id it does not hide the sub categories. As I have A LOT of subcategories, i would not like to add them manually. Also for future usages, when making a new writer sub category, I have to add that id manually again. And that would be a problem.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Your Advertisement Here