WordPress: The Difference Between is_home and is_front_page

Categories

Tips, Web Design, WordPress

When making WordPress themes there’s 2 functions that are really handy. is_home and is_front_page. I use them all the time in both themes and plugins. But I can never remember the difference between them.

is_home vs is_front_page

On the surface they are both the same. They tell you if the page you are loading is the front page or not. But there’s more to it than that. So, I thought I would write this so I have something to refer to when I next forget.

What is is_home?

is_home tells you if you are on the blog post list page/ archive page. This is the default WordPress homepage that shows the reverse chronological list of blog posts. However, if you have setup a static front page then the blog post page will move and so it will no longer be true for the actual homepage.

This is confusing because the function is called is_home but it’s not always the homepage. It’s only the homepage if you have not set a static front page.

What is is_front_page?

is_front_page tells you if you are on the front page of the site, whatever the content being shown. If it’s a static home page, or a list of blog posts, or something else it will be true. Any other page and it will be false.

As you can see is_home is not always the homepage (front page), it could potentially be anywhere on your site. Hence the constant confusion.

Let me know what you think on Mastodon, or BlueSky (or Twitter X if you must).

WordPress News

The latest WordPress updates from the WPBriefs Podcast.

Related Posts

30 Jun 2007

WordPress tips and tricks – Custom Page Templates

Some time ago I posted the first of my tips and tricks for WordPress, and I thought it was about time I posted some more so, to start things off, here is a short tutorial on custom page templates in...
26 Aug 2016

My WordPress Wishlist

WordPress 4.6 has recently been released, and now plans are being made for WordPress 4.7. At the start of each new version the WordPress team ask for ideas and suggestions for areas people would like them to focus on. This...
28 Aug 2009

Binary Moon WordPress design vIII

As I briefly mentioned on Monday, I have finally redesigned Binary Moon.I actually started redesigning about 2 years ago. Initially it was going to be an update rather than a totally new look, and I even built most of it,...
04 Nov 2006

WordPress Tips and Tricks – Post in Advance

I’m sure most people know about this but the ability to post things in advance with WordPress is absolutely great. My two blogs (this one and Binary Joy) posted 16 articles whilst I was on holiday despite me not being...
30 Mar 2010

10 WordPress query_posts tips you probably don’t know

I have written a really brief query_post tutorial before, and it did quite well, but both WordPress and my own skills, have advanced considerably since then. So I thought it would be interesting to revisit the query_posts command and see...