I'm not sure I got it right but the following snippet should excludeReplace all the featured category from displaying from most ofcall to in_category('featured') with the front-endcustom function inCategory('featured'), declare it on your functions.php:
add_filter/**
* @param string $category
*
* @return bool
*/
function inCategory('get_object_terms'$category)
{
global $wpdb, $post;
if ( ! $post) {
return false;
}
$query = $wpdb->prepare("SELECT COUNT(t.term_id)
FROM $wpdb->terms AS t
INNER JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id
INNER JOIN $wpdb->term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id
WHERE tr.object_id = %d
AND tt.taxonomy = '%s'
AND t.slug = '%s'
", $post->ID, 'category', $category);
return (bool) $wpdb->get_var($query);
}
The add the following filters:
/**
* @param array $terms
*
* @return array
*/
function remove_featured_category_from_frontend(array $terms)
{
if ( ! is_admin()) {
$terms = array_filter($terms, function ($term) {
if ($term->taxonomy === 'category') {
return $term->slug !== 'featured';
}
return true;
});
}
return $terms;
}
add_filter('get_terms', 'remove_featured_category_from_frontend');
add_filter('get_object_terms', 'remove_featured_category_from_frontend');
Give it a try and let me know.