DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

Do you ever wanted to know how to create a blog with no home page? A friend recently asked me, and I came up with that recipe which automatically redirect visitors to your latest blog post when trying to visit the homepage.

To apply this tip, paste the code below to your homepage file (Most of the time it is named index.php). Please note that you’ll receive a PHP warning if you try to display anything before the wp_redirect() function on line 10.

home.php (Blog Home Page):
Redirect To First Post

if (have_posts()) {
    while (have_posts()) {

Thanks to Ashton Sanders for the tip!


  1. Is it possible to move the redirect to a page instead of first post?
    I really would like to show a page on my wordpress instead of posts. I know you can change it under the option of settings – reading… But then it shows all the pages as tabs….

  2. Hey, I would also like to know how to change it from a post to a page. For example an “about me” page.


  3. if (have_posts()) {
    while (have_posts()) {

    the number is the ID which you can find if you view source on the page you want, it’ll be in one of the div tags near the top. but you can just use the url but if you change the page title it won’t work.



  4. Your a legend… thank you so much!!!!

Leave a Comment

Your email address will not be published. Required fields are marked *