How to obtain current page permalink url from a function on call on a page template and not from inside the Loop?


/ Published in: PHP
Save to your folder(s)

I got the answer to this question on WordPress Stack Exchange website:

http://wordpress.stackexchange.com/questions/6931/is-there-a-wordpress-function-that-i-can-use-to-retrieve-the-current-page-that-is


Copy this code and paste it in your HTML
  1. // call get_page_link($post->ID)
  2. // where $post-is a WordPress variable and needs to be global if called from inside a function.
  3. get_page_link($post->ID);

URL: http://wordpress.stackexchange.com/questions/6931/is-there-a-wordpress-function-that-i-can-use-to-retrieve-the-current-page-that-is

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.