Exclude One Category and its Subcategories using WP_LIST_FILTER
I need to exclude a category and its subcategories in posts. This is the code I’m working on and it works: <?php $categories = wp_get_post_terms($post->ID, ‘category’); $categories = wp_list_filter($categories, array(‘slug’=>’regione’), ‘NOT’); $categories = wp_list_filter($categories, array(‘slug’=>’lazio’), ‘NOT’); $categories = wp_list_filter($categories, array(‘slug’=>’rm’), ‘NOT’); if (!empty($categories)) { ?> <ul class=”category”> <?php foreach ($categories as $category) { $cat = … Read more