I need to search custom post type by tagids. I have created a post type that is "gampu". In this post type i have register 5 tags taxonomy like 'fitting', 'adapter', 'type', 'volume' and 'gaki'. Now admin can create many tags in this tag taxonomies and when admin create any post then they will select the tags from all of those 5 register tag taxonomies.
On front end i want to add filter by tag. When user select (checkboxes) tags and click on search i need to fetch only those post that associated by tag ids. I have tried below code but its not working for me.
$args = array(
'post_type' => 'gampu',
'posts_per_page' => -1,
'tag__in' => array(30,31,34),
'post_status' => 'any',
'orderby' => 'ID',
'order' => 'DESC'
);
$query = new WP_Query($args);
echo '<pre>'; var_dump($query->request); echo '</pre>';
$getpost = get_posts($args);
echo '<pre>'; var_dump($getpost); echo '</pre>';
Nothing is coming from this code. Fix me if i am wrong anywhere in above code.