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' );
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' );