这应该行得通
function exclude_posts( $query ) {
if ( $query->is_home() ) {
$query->set( \'tag__not_in\', array( 13 ) );
}
}
add_action( \'pre_get_posts\', \'exclude_posts\' );
tag 和
tag_id 不是像这样设置的
cat 接受负数(ID号)作为排除(基于实验得出的结论,而不是深入研究代码(也许是其他时间!)。此外,法典中的所有示例都使用
is_home(),
is_admin(), 等等,但显然
is_home 确实有效-没有
().