Hi there, I’m trying to get the current tag of my post to then pass as a variable into a new wp_query so that I can show other posts that share the same tag. I’m also excluding the current post from the query so that it doesn’t show up twice. I just read through all the pages in wp_query support forum and I’m still not getting it. I know it has to be a simple answer. A little new to php so I’m guessing it’s my syntax. I’d really appreciate any help. Thanks.
HERE IS MY CODE:
<?php $current_tag = single_tag_title(); ?>
$temp = $wp_query;
$wp_query = null;
$wp_query = new WP_Query();
<?php while ($wp_query->have_posts()) : $wp_query->the_post();
if( $post->ID == $do_not_duplicate ) continue;
- The topic ‘passing current single_tag_title as variable into new wp_query’ is closed to new replies.