is_home() vs is_archive()

To properly understand the difference, you have to dig into the WordPress Core

  • is_archive() (defined in wp-includes/query.php#L140) checks any type of archive page. These archive pages is defined in the WP_Query class in wp-includes/query.php#L1615 lines 1615 and line 1616

    1615    if ( $this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax )
    1616    $this->is_archive = true;
    
  • is_home()(defined in wp-includes/query.php#L443) will return true when you are on the home page, which is whenever any of the conditions/pages returns false as defined in the WP_Query class in wp-includes/query.php#L1648 lines 1648 and 1649

    1648    if ( !( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup || $this->is_robots ) )
    1649    $this->is_home = true;
    

As for your question, whenever a static front page is set, WordPress uses front-page.php, page.php or any other custom page template. The proper conditional to use here is is_front_page()

For the page set as the blog page, WordPress uses home.php or index.php. This is your actual homepage of your blog, and not an archive page. is_home() will return true and is_archive() will return false as expected

For futher reading:

Leave a Comment