代码如下 | 复制代码 |
while ( have_posts() ) : the_post(); ?>
|
代码如下 | 复制代码 |
//在首页中排除某些分类
function exclude_category_home( $query ) { if ( $query->is_home ) { $query->set( 'cat', '-20, -22' ); //你要排除的分类ID } return $query; } add_filter( 'pre_get_posts', 'exclude_category_home' );
|
a