Quantcast
Channel: User user3040610 - Stack Overflow
Viewing all articles
Browse latest Browse all 44

Answer by user3040610 for Exclude posts that belong to both of two categories

$
0
0

It should be like this:

function exclude_category( $query ) {if ( $query->is_home() && $query->is_main_query() )    {    $query->set( 'cat', '-16,-9' );   }}add_action( 'pre_get_posts', 'exclude_category' ); 

Viewing all articles
Browse latest Browse all 44

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>