Created
January 14, 2016 16:13
-
-
Save JoshRiser/5a274a064ee547641ab5 to your computer and use it in GitHub Desktop.
Get the slug of any post or page easily
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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