Jetpack Related Posts: Exclude Multiple Categories
-
Hi, I’m a beginner who is customising jetpack’s related post module through the code provided on this link: https://jetpack.com/support/related-posts/customize-related-posts/
I’d like to exclude multiple categories from appearing in the related posts module, however, the code below is only for one category.
function jetpackme_filter_exclude_category( $filters ) { $filters[] = array( 'not' => array( 'term' => array( 'category.slug' => 'dogs', ), ), ); return $filters; } add_filter( 'jetpack_relatedposts_filter_filters', 'jetpackme_filter_exclude_category' );
I am currently replacing the slug ‘dogs’ for the slug of the category I want to exclude, but I have more than one category I’d like to exclude.
I’m not sure how to add new categories to this code and was wondering if you could share similar code but for multiple (2+) categories.
Thank you
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Jetpack Related Posts: Exclude Multiple Categories’ is closed to new replies.