WordPress is_home() Function

Beginner
4 min read
Updated: Nov 2026
3 examples
Conditional tag

Definition

In WordPress, is_home() returns true on the blog posts index, the page that lists your latest posts. This can be the front page or a separate Posts page.

The name is confusing. It does not mean "the home page". For the site front page, use is_front_page().

Syntax

Use it as the test of an if statement.

WordPress
if ( is_home() ) {
  // code for the true path
} else {
  // code for the false path
}
CallWhat it does
is_home()True on the blog posts index.
is_front_page()True on the site front page.
is_home() && ! is_front_page()True on a separate Posts page.

The theme file for this page is home.php (or index.php if there is no home.php).

Full declaration
WordPress
is_home(): bool

Parameters

ParameterDescription
NoneThis function takes no parameters.

Return Value

Return ValueDescription
booltrue if the main query is the blog posts index, otherwise false.

WordPress Examples

Three short theme examples. Each one shows what prints on the true path and the false path.

Example 1 — Blog page heading

Print a heading only on the blog index.

WordPress
<?php if ( is_home() ) {
  echo '<h1>Latest from the blog</h1>';
} ?>

How It Works

  1. is_home() is true on the page that lists posts.
  2. The heading is printed only there.
  3. Single posts and pages skip it.

Example 2 — Separate Posts page

Detect the Posts page when a static front page is used.

WordPress
<?php if ( is_home() && ! is_front_page() ) {
  echo 'This is the Posts page.';
} ?>

How It Works

  1. is_home() is true on the Posts page.
  2. ! is_front_page() removes the case where the home URL lists posts.
  3. Only the separate blog page matches.

Example 3 — Different sidebar on the blog

Choose a sidebar by page type.

WordPress
<?php
if ( is_home() ) {
  dynamic_sidebar( 'blog-sidebar' );
} else {
  dynamic_sidebar( 'sidebar-1' );
} ?>

How It Works

  1. The if runs on the blog index.
  2. Other pages use the normal sidebar.
  3. Both calls print widgets for the sidebar you name.

Frequently Asked Questions

It returns true or false (a bool). Use it inside an if statement.
No. It is the blog posts index. Use is_front_page() for the site front page.
No. On a static front page, is_home() is false. It is true only on the page set as Posts page.
WordPress uses home.php, then index.php. With a static front page it uses front-page.php for the home URL.
Conditional tags need the main query. Call them in template files or on hooks such as wp or template_redirect, not directly at the top of functions.php.

Next: is_main_site()

Check if a site is the main site of a multisite network.

is_main_site() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

9 people found this page helpful