Does anyone knows how to get the post name/slug?

Discussion in 'WordPress' started by dreteh, Mar 2, 2010.

  1. #1
    Hello,

    I know that you can call the_title() to get post title within the loop.
    But is there a function I can call to get the post name or slug? (ex, my-post-name)

    Thank you.
     
    dreteh, Mar 2, 2010 IP
  2. dreteh

    dreteh Member

    Messages:
    514
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    33
    #2
    For people who have the same question.
    Here is what I did:

    global $post;
    $slug = $post->post_name;
     
    dreteh, Mar 3, 2010 IP