WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is a simple question, that's probably been asked before. For internal links between pages, is it better to use a relative link or full permalink?

Thank you.

share|improve this question
up vote 3 down vote accepted

It depends on what you're talking about. If you're talking about using just

<a href="/page-title">Page Title</a>, then no. It's better to use the full link.

However, instead of using http://www.domain.com/page-title, it's better to use

<?php echo bloginfo('url'); ?>/page-title.

The reason you don't want to use relative links is the way wordpress permalinks work. If you're on a sub-page (domain.com/about/john) and you use a relative link to another subpage (href="/jane"), it will point to the root URL (domain.com/jane instead of domain/about/jane.


The full <a> will be

<a href="<?php echo bloginfo('url'); ?>/page-title">Page Title</a>

share|improve this answer
Hi Josh, Thank you very much for your explanation. Just to clarify, the best way is to do it like so: <a href="<?php echo bloginfo('home'); ?>/page-title</a> ? Did I understand correctly? What if the structure of my site is: domain.com/subpage/subpage/page-title. Would bloginfo('home') find a page that is down the hierarchy? Thank you! – Laxmidi Jul 30 '11 at 3:47
Laxmidi, check my update. You want to have /page-title after the <?php ?> tag, but before the end of the href="" attribute. – Josh Allen Jul 30 '11 at 3:58
bloginfo('home') gets the domain entered in Settings -> General -> Wordpress address (URL) – Josh Allen Jul 30 '11 at 4:00
bloginfo( 'home' ) is deprecated use bloginfo( 'url' ) instead. See the Codex for proper usage of bloginfo() – Chris_O Jul 30 '11 at 4:10
@Chris_O updated answer to show 'url' instead of 'home'. Thanks for the info. – Josh Allen Jul 30 '11 at 4:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.