WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Get slug/permalink name for page (4 posts)

  1. shastaw
    Member
    Posted 4 years ago #

    I was using $posts[0]->post_title to get the name of the current Page, but I really need to get the current slug/permalink. $posts[0]->post_slug doesn't give me anything (echo $posts[0]->post_slug is empty.)

    I'm thinking that categories have slugs, but Pages have permalinks, but I'm not guessing the correct field name. Can anyone help?

  2. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

  3. shastaw
    Member
    Posted 4 years ago #

    Thank you! I appreciate the link to where I can find info next time, in addition to the answer -- this is a great forum.

  4. Beee
    Member
    Posted 4 years ago #

    can this be used outside the loop ?

Topic Closed

This topic has been closed to new replies.

About this Topic