Is there a wordpress function that I can use to retrieve the current page that is loaded?

Suppose that I create a page in the admin section (under ‘Pages’) and I have permalinks turned on and this pages slug is ‘my-new-page’, then is there a WordPress function that will work outside the (blog) Loop that I can use in that page’s template on my theme that will retrieve that page’s permalink?

Related posts

Leave a Reply

2 comments

  1. Hi @racl101:

    I think what you are after is to use get_page_link($post->ID). The value $post will have been set by the default query to be equal to the post for the current page and should be in scope when your page template is run.