When to Use is_home() &  is_front_page()

In WordPress you can conveniently display, run or show something when certain conditions are met using conditional tags. I frequently find myself using the two most ambiguous tag’s: is_home() and is_front_page().

Don’t be fooled, though these two tags might be seamingly similar, they are two very different beasts. Let’s take a look at how they operate.

is_home()

This conditional tag determines if the current page is using the listing your recent blog posts. This template is used to list out all of your blog posts in reverse chronological order. If you’re using an out of the box WordPress setup, the recent blog posts template is your home page.

If you’re using WordPress as a CMS, you’ve probably set the system to use a static Page as your front page. If this is the case, is_home() will return false on the home page, because your recent posts are not being displayed. If you have set a page to display your recent posts, is_home() will return true when that page is displayed because your recent posts are being listed.

In other, technical, words is_home() will return true when the theme template is set to index.php, regardless of where

is_front_page()

This tag will return true when you are in the main (or front) page of your website, regardless of whether it’s a page or a list your recent posts. Any inner page will return false for is_front_page(), even if it is listing your recent blog posts.

Hopefully this clears up the difference between is_home() and is_front_page(). This was a tricky concept to understand when I first began working with WordPress.

Meet the Author

Kevin Leary, WordPress Consultant

I'm a custom WordPress web developer and analytics consultant in Boston, MA with 17 years of experience building websites and applications. View a portfolio of my work or request an estimate for your next project.