FindsGood

How to get post slug from single post template in wordpress?

Learn How to get post slug from single post template in wordpress.

You can get that using the following methods:

<?php $post_slug = get_post_field( 'post_name', get_post() ); ?>

Or You can use this easy code:

<?php
global $post;
$post_slug = $post->post_name;
?>

<?php echo 'http://findsgood.com/'.get_post()->post_name.'/'; ?>

Comment

WordPress Tips and Tricks