從帖子列表編輯共享中排除類別
add_action( 'pre_get_posts', 'single_category_exclude' );
function single_category_exclude( $query ) {
if( !$query->is_main_query() || is_admin() ) return;
$query->set( 'cat', '-1' );
return;
}
add_action( 'pre_get_posts', 'single_category_exclude' );
function single_category_exclude( $query ) {
if( !$query->is_main_query() || is_admin() ) return;
$query->set( 'cat', '-1' );
return;
}