I'm creating common "Single Tag Page" for different Post Types.
I'm using next code:
$loop = new WP_Query( array( 'post_type' => 'any', 'tag' => single_term_title( '', false ), 'posts_per_page' => 10 ) );
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="entry-content">
<?php the_excerpt(); ?>
</div><!-- .entry-content -->
<?php endwhile; // End the loop. ?>
It works fine until there is no taxonomy terms conflict.
For example:
If I have Category & Tag names - "Videos", Category will have slug - "/videos" & Tag "/videos-2".
In case when slug isn't the same as taxonomy name above code does not working.
I need an alternative function for single_term_title(), something like "single_term_slug()".
Any ideas?
P.S. I was thinking about "get_term_by()" function, but I didn't had luck to adopt it to the code above.
Updated: I've posted my code below.