Skip to content

Instantly share code, notes, and snippets.

@scottnunemacher
Created October 13, 2022 19:09
Show Gist options
  • Save scottnunemacher/41396b8aafbc0e08ac3b9f28d99d5fab to your computer and use it in GitHub Desktop.
Save scottnunemacher/41396b8aafbc0e08ac3b9f28d99d5fab to your computer and use it in GitHub Desktop.
WP Get Post Slug
<?php
$slug = get_post_field( 'post_name', get_post() );
echo $slug;
?>
@scottnunemacher
Copy link
Author

Easy way to get post slug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment