I would like to change WordPress's RSS
feed functionality to only match posts and pages that has all of the tags (not just one) when I specify multiple tags. I've already added code to include pages on top of posts.
Example URL: ~WP~/feed/?tag=holiday,halloween
I'm trying to alter the query inside the pre_get_posts
action hook.
Code:
if ($_GET['tag']) {
$tagsArray = explode(',', $_GET['tag']);
array_push($query->tax_query, array(
'taxonomy' => 'post_tag',
'field' => 'slug',
'terms' => $tagsArray,
'operator' => 'AND',
));
}
Can someone point me in the right direction on how to make the query match all of the tags? Thanks!