Skip to content

Instantly share code, notes, and snippets.

@MrJSdev
Last active April 15, 2017 02:57
Show Gist options
  • Select an option

  • Save MrJSdev/7a7b8b15289ef0c602592f792bf6ea84 to your computer and use it in GitHub Desktop.

Select an option

Save MrJSdev/7a7b8b15289ef0c602592f792bf6ea84 to your computer and use it in GitHub Desktop.
This another way of displaying page slug in WordPress. The full guide is available at http://extracatchy.net/retrieve-the-slug-of-current-page-wordpress/
<?php
// get page slug name
$slug = get_post_field( 'post_name');
// echo the $slug
echo $slug;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment