I'm on the tag.php page. How can I get its slug?
single_tag_title()
gets the title just fine, but the slug?
You can get the slug by getting the queried object while on the tag page, like so:
<?php
$tag = get_queried_object();
echo $tag->slug
?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With