/* Hide Featured Image for Spesific Category */
function hide_featured_image_for_spesific_category( $default, $post_id, $key ) {
if ( is_single() && is_singular() ) {
if ( 'jnews_primary_category.id' !== $key ) {
$post = get_post();
if ( is_object( $post ) && $post->ID ) {
$post_cat = get_the_category( $post->ID );
$primary_cat = jnews_get_primary_category( $post->ID );
$primary_cat = get_category( $primary_cat );
$post_cat_slug = array();
array_push( $post_cat, $primary_cat );
/* Get Category Slug */
foreach ( $post_cat as $cat ) {
if ( ! is_wp_error( $cat ) && isset( $cat->slug ) ) {
array_push( $post_cat_slug, $cat->slug );
}
}
if ( in_array( 'gaming', $post_cat_slug ) ) { /* `gaming` is slug category you want to disable Featured Image */
if ( 'jnews_single_post.override_template' === $key ) {
return true;
}
if ( 'jnews_single_post.override.0.show_featured' === $key ) {
return false;
}
}
}
}
}
return $default;
}
add_filter( 'jeg_vp_metabox', 'hide_featured_image_for_spesific_category', null, 3 );