仅显示一个类别的帖子
add_action( 'pre_get_posts', 'single_category' );
function single_category( $query ) {
if( !$query->is_main_query() || is_admin() ) return;
$query->set( 'cat', '1' );
return;
}
add_action( 'pre_get_posts', 'single_category' );
function single_category( $query ) {
if( !$query->is_main_query() || is_admin() ) return;
$query->set( 'cat', '1' );
return;
}