-
-
Save ki11ua/b070c274c9fb20996270c473409753cb to your computer and use it in GitHub Desktop.
create the_slug() function for WordPress
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($echo=true){ | |
$slug = basename(get_permalink()); | |
do_action('before_slug', $slug); | |
$slug = apply_filters('slug_filter', $slug); | |
if( $echo ) echo $slug; | |
do_action('after_slug', $slug); | |
return $slug; | |
} | |
// credit: http://www.tcbarrett.com/2011/09/wordpress-the_slug-get-post-slug-function/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment