Get wordpress permalink outside of the loop
December 15, 2008 · Print This Article
If you want to get a permalink outside of the loop. Here’s how to do it easily.
To get a permalink outside of the loop, you have to use the get_permalink() function. That function takes a single argument, which is the ID of the post you’d like to get the permalink:
<a href="<?php echo get_permalink(10); ?>" >Read the article</a>
You can also use this function with the $post global variable:
<a href="<?php echo get_permalink($post->ID); ?>" >Read the article</a>





















[...] In other news, I’ve added the canonical URL to single post pages, so that Google webmaster tools should stop bothering about duplicate pages. Some precious info found at Live Experience. [...]