From the it looks like you want to get all products grouped by category. Your query seems to be correct except $term_slug
need not be in quotes.
$tax_post_args = array(
'post_type' => 'bpo_microsoftoffice',
'posts_per_page' => 999,
'order' => 'ASC',
'tax_query' => array(
array(
'taxonomy' => 'bpo_microsoftoffice_reg',
'field' => 'slug',
'terms' => $term_slug
)
)
);
Edit:
Method 1:
If you want just query you wrote, use WP_Query($tax_post_args );
.
Method 2:
If you want both category
plus custom_taxonomy
, add 'category' => $cat_id,
in $tax_post_args
.
So,
$tax_post_args = array(
'post_type' => 'bpo_microsoftoffice',
'posts_per_page' => 999,
'order' => 'ASC',
'tax_query' => array(
'relation' => 'OR',
array(
'taxonomy' => 'bpo_microsoftoffice_reg',
'field' => 'slug',
'terms' => $term_slug
),
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => $cat_id
),
)
);
And the use WP_Query($tax_post_args);
This is assuming your post_type
is having category
as well as bpo_microsoftoffice_reg
as taxonomies. If only bpo_microsoftoffice_reg
is assigned, use first method.