php get page slug code example
Example: php get slug
You can get that using the following methods:
<?php $post_slug = get_post_field( 'post_name', get_post() ); ?>
Or You can use this easy code:
<?php
global $post;
$post_slug = $post->post_name;
?>