I am trying to retrieve the slug of the current WordPress page outside the loop. The title of the page returns with wp_title ()
, but how can I get the slug?
<li>
<a href="https://wordpress.stackexchange.com/slug-of-current-page/">
<?php wp_title('', true); ?>
</a>
</li>