Sorry for this, but I really combed everything there is on the subject and cannot come to the solution, although it is probably super-simple:

I have a front-page.php set as the static front page of the WordPress site. In it there is a link that I'd like to link to the home.php or index.php.

How do I write the url?

<a  href='<?php echo esc_url( home_url()); ?>' title='<?php echo esc_attr( get_bloginfo( 'title' ) ); ?>' rel='home'> 

What do i write instead of home_url() , which lands me of course on the front-page.php ?

Thank you very much for your help!

2 Answers 2


There really should be a simpler way to do it but you kind of need to know that WordPress stores both the Front Page ID and Blog Page ID in the options table. So, to get the URL of the blog you need to use both get_permalink() and get_option() in conjunction.

<a href='<?php echo esc_url( get_permalink( get_option( 'page_for_posts' ) ) ); ?>' title='<?php echo esc_attr( get_bloginfo( 'title' ) ); ?>' rel='home'>Blog Page</a>

The above will grab page_for_posts value from the options table which holds the Page ID of the blog which needs to be set in Settings -> Readings. By passing an ID to get_permalink() it will return the string URL that we need for the page.

  • Yes, you say it! There really should be a way to do this! I have spent a week now looking for a solution... Thank you for your answer - it's completely logical, and i have also thought that 'page_for_posts' should be a part of the solution, alas! This returns me to the site's starting page. It's a mess. :/
    – furby
    Jun 15, 2017 at 8:31
  • @furby Have you set a blog page in Settings -> Reading along with your Front Page? I believe when you set one you have to set the other.
    – Howdy_McGee
    Jun 15, 2017 at 14:12

Well, to close this question, first of all - thank you, @Howdy_McGee! You were on the right track, and the solution that works is

<a href="<?php echo get_permalink( get_option( 'page_for_posts' ) ); ?>">Blog Page</a>

The esc_url is not doing the job here. I'm not that apt of a developer to know why, though I'd love to. Thank you again!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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