WordPress codex for page

How to get the current page slug?

global $post;
$slug = get_post( $post )->post_name;

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *