Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared hosting Managed WordPress Cloud hosting VPS hosting By reader location Hosting finder
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Blog Best backup plugins Deals
Guides All guides Speed up WordPress Choose hosting Back up WordPress
How we test

Troubleshooting

WordPress Is_home Not Working: Causes and How to Fix It

WordPress Is_home Not Working: Causes and How to Fix It

Short answer

is_home() checks for the blog posts index, not the homepage, so it returns false on a static front page. It also fails when called before the main query runs. Use is_front_page() for the homepage and call conditionals inside a hook such as template_redirect.

Key takeaways

  • is_home() means the blog posts index, not the front page.
  • Use is_front_page() for the site homepage.
  • Conditional tags return false before the main query runs.
  • Inside pre_get_posts, use $query->is_home() with is_main_query().
  • query_posts() and missing resets break later conditionals.
  • Query Monitor shows which conditionals are true on a page.

Why is is_home() not working in WordPress?

is_home() usually “fails” because it checks for the blog posts index, not the site's front page, or because your code runs before WordPress has set up the main query.

The name is misleading. Most people expect is_home() to mean “the homepage”, but WordPress uses it for the page that lists your latest posts.

On a site that shows latest posts on the front page, both ideas match, so the function seems fine. The moment you set a static front page under Settings > Reading, the two split and code breaks.

The other common cause is timing. Conditional tags only return the right answer after WordPress has parsed the request, so calls made too early always return false.

This guide covers each cause, with fixes you can copy into a child theme or a small plugin.

What does is_home() actually check?

is_home() returns true when the current request is the blog posts index, whether that sits on the front page or on a separate posts page.

The is_home() reference describes it as checking whether the query is for the blog homepage. That means the page showing your list of recent posts.

Its partner is is_front_page(). The is_front_page() reference explains that it returns true on the site's front page, whatever that page shows.

Reading settingsFront page URLPosts page URL
Homepage displays latest postsis_home() true, is_front_page() trueNo separate posts page
Static front page plus posts pageis_home() false, is_front_page() trueis_home() true, is_front_page() false
Static front page, no posts page setis_home() false, is_front_page() trueNo blog index at all

If you remember this table, most is_home() problems solve themselves.

Cause 1: Are you using a static front page?

If your site uses a static front page, is_home() will be false on that page and true only on the page you chose as the Posts page.

Check Settings > Reading in your dashboard. If Your homepage displays is set to A static page, your homepage is a normal page, so is_home() correctly returns false there. The static front page guide explains how these settings work.

The fix is to use the right function for what you mean:

// The site's front page, whatever it shows
if ( is_front_page() ) {
    // code for the homepage
}

// The blog posts index
if ( is_home() ) {
    // code for the blog list
}

// Only the default "latest posts" homepage
if ( is_front_page() && is_home() ) {
    // code for a homepage that lists posts
}

Many themes and snippets copied from old tutorials use is_home() when they really mean is_front_page(). Swap the function and test again.

Cause 2: Is your code running too early?

Conditional tags like is_home() only work after WordPress has run the main query, so calling them directly in functions.php or on early hooks returns false.

When WordPress loads functions.php, it has not yet worked out which page the visitor asked for. Any is_home() check at that moment has nothing to look at.

With debugging turned on, WordPress may log a notice saying that conditional query tags do not work before the query is run. Our guide on checking PHP error logs shows where to find it.

Wrap the check in a hook that fires after the query is ready, such as wp or template_redirect:

add_action( 'template_redirect', function () {
    if ( is_home() ) {
        // safe: the main query has run
    }
} );

Hooks like init, plugins_loaded and after_setup_theme fire too early. If you need to learn more about hook order, see our guide on using WordPress hooks, actions and filters.

Cause 3: Are you checking inside pre_get_posts?

Inside pre_get_posts, use the query object's own method, $query->is_home(), together with $query->is_main_query(), not the global is_home() function.

The pre_get_posts hook runs for every query on the page, including menus, widgets and custom loops. The global function looks at the main query, which may not be the one you are changing.

add_action( 'pre_get_posts', function ( $query ) {
    if ( ! is_admin() && $query->is_main_query() && $query->is_home() ) {
        $query->set( 'posts_per_page', 6 );
    }
} );

Without the is_main_query() guard, your change can leak into sidebars or related post blocks. The is_admin() check stops it affecting dashboard lists.

Cause 4: Did a custom query overwrite the main query?

If a template uses query_posts() or forgets to reset after a custom loop, later is_home() checks read the wrong query and return unexpected values.

query_posts() replaces the global main query, which confuses every conditional tag that runs after it. The WordPress docs advise against it for this reason.

Use a separate WP_Query object for extra loops, and call wp_reset_postdata() afterwards. If old code still uses query_posts(), call wp_reset_query() straight after its loop.

Our guide on using WP_Query shows the safe pattern for secondary loops.

Cause 5: Is the wrong template loading?

If your theme has a front-page.php file, WordPress uses it for the front page even when it shows posts, which can make is_home() logic in home.php seem to do nothing.

The template hierarchy decides which file loads. For the front page, WordPress looks for front-page.php first. For the posts index, it looks for home.php, then index.php.

So code you placed in home.php will not run on a static front page, and code in front-page.php will not run on the separate posts page.

Block themes follow the same idea with front-page, home and index templates in the Site Editor. Our explainer on what a WordPress template is covers this in more detail.

Cause 6: Are you checking in the admin or a REST request?

is_home() is always false in the dashboard, in AJAX handlers and in REST API requests, because none of those load the blog index.

If your code runs during admin-ajax.php calls, a REST endpoint or a block editor preview, the main front-end query does not exist.

Pass the context you need from the page instead. For example, add a data attribute or a hidden field with the page type, then read it in your AJAX or REST handler.

How do you debug is_home() quickly?

Print the result of the conditional tags on the page, or use Query Monitor, to see which ones WordPress thinks are true for the current request.

A quick temporary snippet in a child theme works on a staging site:

add_action( 'wp_footer', function () {
    if ( current_user_can( 'manage_options' ) ) {
        var_dump( is_home(), is_front_page(), get_option( 'show_on_front' ) );
    }
} );

The PHP var_dump function prints each value with its type, so you can see true and false clearly. Remove the snippet when you finish.

A cleaner option is the free Query Monitor plugin. Its conditionals panel lists every conditional tag that is true on the current page. Our guide on how to use Query Monitor walks through it.

Which conditional should you use instead?

Pick the conditional that matches the page you mean, because each one answers a slightly different question.

You want to targetUse
The site's homepage, whatever it showsis_front_page()
The blog posts listis_home()
A homepage that lists latest postsis_front_page() && is_home()
A specific pageis_page( 'slug' )
Any archive, including category listsis_archive()
A single blog postis_single()

The conditional tags handbook page lists every option with examples.

How do you stop the problem coming back?

Write conditionals inside hooks that run after the query, name what you mean, and test with both Reading settings before you ship.

A few habits help:

  • Prefer is_front_page() for homepage logic unless you really mean the blog list.
  • Never call conditional tags at the top level of functions.php.
  • Use $query methods inside pre_get_posts.
  • Avoid query_posts() in templates.
  • Test on staging with latest posts and with a static page selected.

If you edit theme files, use a child theme so updates do not wipe your fixes. Our explainer on what a child theme is shows how to set one up.

Frequently asked questions

What is the difference between is_home() and is_front_page()?

is_home() is true on the blog posts index, while is_front_page() is true on the site's front page. When the homepage shows latest posts, both are true there. With a static front page, is_front_page() is true on the homepage and is_home() is true only on the posts page.

Why does is_home() return false in functions.php?

functions.php loads before WordPress has parsed the request and run the main query. Conditional tags have nothing to check at that point, so they return false. Move your check into a later hook such as wp or template_redirect.

Can I use is_home() inside pre_get_posts?

Use the method on the query object instead, as in $query->is_home(), and combine it with $query->is_main_query(). The global function looks at the main query, which may not be the query being changed when the hook fires.

Does is_home() work in block themes?

Yes. The function works the same way in block themes because it depends on the query, not the theme type. Block themes use front-page, home and index templates in the Site Editor, following the same template hierarchy as classic themes.

Why is is_home() true on my blog page but not my homepage?

Your site uses a static front page, so WordPress treats the page you set as the Posts page as the blog index. That is the expected behaviour. Use is_front_page() for code that should run on the homepage.

Sources

  1. is_home() WordPress Developer Resources
  2. is_front_page() WordPress Developer Resources
  3. Conditional Tags WordPress Developer Resources
  4. pre_get_posts WordPress Developer Resources
  5. Template Hierarchy WordPress Developer Resources
  6. Create a static front page WordPress.org

Is your product missing, or something out of date?

Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.

About the editors

Written and checked byWPLegible Editorial Team Independent WordPress reviews and guides

Researched from the primary sources listed above and checked against our editorial rules before publishing.