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

I can't believe I did not find the right function for this: I just want to retrieve the blog index url from a template.

My homepage is a static page. I am not looking for bloginfo('url') because it gives me my root url (/). I am looking for mysite.com/Blog

I am thinking about getting it via get_permalink($mypageid) but it is a bit dirty.

share|improve this question
up vote 1 down vote accepted

if you are referring to the 'posts page' as set under dashboard - settings - reading:

if( get_option( 'page_for_posts' ) ) { 
  echo get_permalink( get_option( 'page_for_posts' ) ); 
} else { 
  echo home_url(); 
share|improve this answer
Thank you very much. – pauletienney Jun 6 '13 at 12:57

<?php echo home_url(); ?> <-- Set in Settings > General > WordPress address

<?php echo site_url(); ?> <-- Set in Settings > General > Site address

share|improve this answer
Hello. Thank you for answering but both snippets you gave link to the site home, not the blog home. – pauletienney Jun 6 '13 at 9:32
So set it to whatever you need it to be in your General Settings page. – Marc Dingena Jun 6 '13 at 9:36

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.