您可以使用post__not_in
使用get_the_ID
在这种情况下,您的代码应该如下所示:
$args = array(
\'post_type\' => \'custom_post_type\',
\'tax_query\' => array(
array(
\'taxonomy\' => \'custom_taxo\',
\'field\' => \'term_id\',
\'terms\' => array(1,2,5),
\'operator\' => \'IN\'
)
),
\'post__not_in\' => array (get_the_ID()),
);
$query = new WP_Query( $args );
Note: 值必须是数组
\'post__not_in\' => array (get_the_ID())