Last active
June 5, 2017 13:23
-
-
Save ingozoell/ec81e8682c7b494431222003913f71c1 to your computer and use it in GitHub Desktop.
WordPress get slug name
This file contains hidden or 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
// Outside the loop: | |
<?php | |
$post_id = 11; | |
$post = get_post($post_id); | |
$slug = $post->post_name; | |
?> |
This file contains hidden or 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
global $post; | |
echo $post->post_name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment