I have custom taxonomy registered for custom post type and pages with same value how can get posts when the checkbox is checked by taxonomy in Pges .
This To Get Terms in variable
$category = get_terms([
'taxonomy' => 'category',
'hide_empty' => false,
]);
$category = get_terms([
'taxonomy' => 'category',
'hide_empty' => false,
]);
$property_area = get_terms([
'taxonomy' => 'property_area',
'hide_empty' => false,
]);
$property_type = get_terms([
'taxonomy' => 'property_type',
'hide_empty' => false,
]);
WordPress query
$rent_properties = array(
'post_type' => 'properties',
'posts_per_page' => 20,
'post_status' => 'publish',
'paged' => $paged,
'tax_query' => array(
'relation'=>'AND',
array(
'taxonomy'=>'category',
'field' => 'field_id',
'terms' => $category,
),
array(
'taxonomy'=>'property_area',
'field' => 'fild_id',
'terms' =>$property_area,
),
array(
'taxonomy'=>'property_type',
'field' => 'slug',
'terms' => $property_type
)
)
);
1- Create a template and assign this template to the all desired pages that have those taxonomies
2-In this template code, detect the selected taxonomy(that you have been chosen from admin panel page editor)
3-In the template code, get all posts that have those taxonomy
$args = array(
'tax_query' => array(
array(
'taxonomy' => 'genre',
'field' => 'slug',
'terms' => 'jazz'
)
)
);
$postslist = get_posts( $args );
Reference: https://codex.wordpress.org/Template_Tags/get_posts