Skip to main content
Easily create better & faster websites with the Total WordPress Theme Learn More
(opens a new tab)

WordPress Front Page vs Homepage

WordPress is a terrific CMS. You can do whatever you want with it. But sometimes, you may find an issue with some basic functions. For example, you are probably using the is_front_page and is_home WordPress Homepage conditional in your themes and plugins (you can learn more about conditional functions in our Conditional Tags post). But you’re doing it wrong !

Homepage Settings

With those conditional functions, you can check if the homepage is being displayed (is_home), or if the homepage is using a static page (is_front_page). You can define such behaviour in Settings=> Reading.

In your plugin or theme, you may use this functions to display or change contents depending on user settings. But you are doing a huge mistake : you are not taking into account the static blog page. When you define a static page for your homepage, you can also define a blog page : it will replace the default WordPress homepage in order to list every post.

Long story made short : is_front_page should always be tested with and before is_home. And here’s why.

How It Works

1. Normal settings:

The default WordPress homepage lists your latest posts.

  • Here is the URL : website.com
  • is_home returns TRUE
  • is_front_page returns TRUE

Here, there isn’t any issue.

2. Static homepage:

The homepage is using one of your static pages.

  • The URL is still website.com
  • is_home returns FALSE
  • is_front_page returns TRUE

There is no issue with your static homepage : is_front_page returns true.

3. Static blog page

One of your page is listing all your post.

  • The URL is website.com/pagename
  • is_home : TRUE
  • is_front_page : FALSE

Here, you may have some problems : is_home is returning TRUE, but this is not your homepage : it’s a WordPress page that lists every post, like a main category archive would do.

Use Conditional Tags

When you create a plugin or a theme, you have to consider that users may use those page settings. So, every time you use is_home, you should always test is_front_page before, and you always should use conditional parameters to do so.

If you don’t, you may have problems with some users. For example, if you only test is_home to display your homepage content, there will be issues with the static homepage that will not display the right content.

Here is how to do it right :

if ( is_front_page() && is_home() ) {

	// Default homepage ( both the front page and the recent posts page)

} elseif ( is_front_page() ) {

	// Static homepage

} elseif ( is_home() ) {

	// Blog page

} else {

	// Everything else

}

This is the only (right) way to display or alter content with your homepage and your blog page.

Important: Please note that these functions work only once WordPress is loaded such as on template files or specific action hooks. You can’t just dump these conditionals into functions.php and expect them to work.

How About You?

Did you already encounter this problem? What was your solution? I want to hear about it!

Recent in WordPress Tips
11 Comments
  1. AJ · 12 years ago

    Thanks Daniel for sharing this guide. I’ve seen a lot of themes doing_it_wrong in the past – I’m sure I probably have done it in the past too when I was learning 😉

  2. Elmer · 12 years ago

    Short, straight to the point, and very informative. Thank you for sharing!

  3. kashem · 12 years ago

    Thanks for the guide . It will help greatly in future projects.

  4. Matt Thiessen · 11 years ago

    What if (is_front_page() && is_home()) still returns true when the URL is myblog.com/page/2/ since this isn’t really my homepage?

    • AJ Clarke | WPExplorer · 11 years ago

      It is actually still a part of your homepage. But you can use is_paged() to check if you are on a sub-page.

  5. Rehman Ali · 11 years ago

    Nice Post Daniel.Thanks for this contribution.

  6. corporate website design in mumbai · 10 years ago

    Thanks for the guide. Solved my problem.

  7. Lockedown Design · 9 years ago

    I was looking for this reference today to solve a specific problem concerning content on the Home/Front page. Thanks, and have a great holiday!

  8. lore · 9 years ago

    Strange, for me it doesn’t work .. event on e fresh wp install.
    I just created a child theme of 2016 with in functions.php (code removed) and I get “everything else” on the site’s root page.

    No matter how I configure the front page display…
    Any idea what’s wrong ?

    • AJ Clarke · 9 years ago

      That’s because WordPress isn’t loaded yet when functions.php is loaded so the conditional doesn’t return true. You need to place the code in a template file such as header.php or you need to hook into an action hook like init such as this example.

  9. Mirco · 6 years ago

    Best explanation on the matter I could find so far, thanks!

Sorry, comments are now closed.