I am trying to make the category page on my Wordpress website. To position some of my content, I use post tags. To get the post that goes in a specific spot on my page, I make a WP_Query with $args for the post that has the wanted tag and is of the correct category. However, some posts go in multiple places and therefore have multiple tags. When I add a second tag to a post, the post isn't returned by either query. It seems like this is because the query is looking for posts and sees that one of the tag matches, but since the other does not match, the post is not retrieved. How do I make it so that the query gets all posts that have the requested tag, but can also have other tags? Here is my query code:
$numberOfSideBarArticles = 4;
$args = array (
'post_type' => 'post',
'cat' => get_query_var('cat'),
'post__not_in' => get_option("sticky_posts"),
'tag' => 'featured-sidebar',
'posts_per_page' => `$numberOfSideBarArticles`
);
$the_query = new WP_Query($args);
featured-sidebar is the tag I am looking for. I want to query for all posts in the category with that tag, even if it has other tags as well. Any help or suggestions are appreciated!