ฉันทำสิ่งต่อไปนี้เพื่อยกเว้นโพสต์จากเทอม taxonomy:
$argos = array(
'tax_query' => array (
array(
'taxonomy' => 'topics', // My Custom Taxonomy
'terms' => 'college', // My Taxonomy Term that I wanted to exclude
'field' => 'slug', // Whether I am passing term Slug or term ID
'operator' => 'NOT IN', // Selection operator - use IN to include, NOT IN to exclude
),
),
'post_type'=>'page', // Post type I want to show, can be a custom post type too
'posts_per_page' => -1,
'orderby' => 'title',
'order'=>'ASC',
'post_parent' =>$post->ID // show child posts or pages of current page/post
);
$query = new WP_Query( $args );