Skip to content

Instantly share code, notes, and snippets.

@JoshRiser
Created January 14, 2016 16:13
Show Gist options
  • Save JoshRiser/5a274a064ee547641ab5 to your computer and use it in GitHub Desktop.
Save JoshRiser/5a274a064ee547641ab5 to your computer and use it in GitHub Desktop.
Get the slug of any post or page easily
function the_slug($post = 0) {
echo apply_filters('the_slug', get_the_slug($post));
}
function get_the_slug($post = 0) {
$post = get_post($post);
return apply_filters('get_the_slug', $post->post_name);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment