从帖子列表编辑共享中排除类别
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;
}