[ad_1]
Hi @elahwyhw23,
What you are describing should be possible with a custom snippet in WPCode.
You can try something like the code below (replace with your category ID) but be aware that if a post has 2 categories and one of them is blog it will still be excluded.
add_filter( 'get_next_post_excluded_terms', 'wpcode_custom_exclude_all_terms_but_blog' );
add_filter( 'get_previous_post_excluded_terms', 'wpcode_custom_exclude_all_terms_but_blog' );
function wpcode_custom_exclude_all_terms_but_blog( $term_ids ) {
$excluded_terms = get_categories(
array(
'hide_empty' => false,
'fields' => 'ids',
'exclude' => array(
1, // Replace with the id of the category you want to include.
),
)
);
if ( empty( $term_ids ) ) {
$term_ids = array();
}
return array_merge( $term_ids, $excluded_terms );
}
