getting custom post by tag
Try this code as by using tag_slug__in, not tag. $search_videos = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘videos’, ‘tag_slug__in’ => $search_query ); $new_query = new WP_Query( $search_videos ); $search_videos_posts = $new_query->posts;