Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    Here is how you could exclude posts from 2 categories, named “cat-1” and “cat-2”:

    function jetpackme_filter_exclude_categories( $filters ) {
    	$filters[] = array( 'not' =>
    		array( 'terms' => array( 'category.slug' => array( 'cat-1', 'cat-2' ) ) )
    	);
    	return $filters;
    }
    add_filter( 'jetpack_relatedposts_filter_filters', 'jetpackme_filter_exclude_categories' );
    Thread Starter zericha

    (@zericha)

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Exclude two categories from Related Posts’ is closed to new replies.