I have a website where I tag some posts with the title of a Page. For example, "Raking Leaves" might be tagged with "Autumn Activities"
Now I'm doing a query on the "Autumn Activities" page to return all posts tagged with "Autumn Activities" - this is where Raking Leaves should appear.
My query looks like this and it's turning up empty. It works fine if the page was just one word - but when I'm querying a tag with two words it gets messed up.
<?php $subslug = $post->post_name; ?> <?php $my_query2 = "tag=" . $subslug . "+anothertag&cat=34"; $my_query2 = new WP_Query($my_query2); ?> <?php if ($my_query2->have_posts()) : while ($my_query2->have_posts()) : $my_query2->the_post(); ?>
The posts are definitely tagged correctly. I can't seem to figure this out!
Any help would be greatly appreciated.