Created
October 31, 2022 16:28
-
-
Save someguy9/a7affe48d9fc40ac406acb0389eb3c19 to your computer and use it in GitHub Desktop.
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
<?php | |
// Get the current post or page's slug | |
$slug = get_post_field( 'post_name', get_post() ); | |
echo $slug; | |
// Get slug for a post or page by ID | |
$post_id = 1; | |
echo get_post_field( 'post_name', $post_id ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment