WP_Query::is_front_page() – Is the query for the front page of the site?

You appear to be a bot. Output may be restricted

Description

Is the query for the front page of the site?

This is for what is displayed at your site's main URL. Depends on the site's "Front page displays" Reading Settings 'show_on_front' and 'page_on_front'. If you set a static page for the front page of your site, this function will return true when viewing that page. Otherwise the same as @see WP_Query::is_home()

Usage

$bool = WP_Query::is_front_page();

Parameters

Returns

bool Whether the query is for the front page of the site.

Source

File name: wordpress/wp-includes/class-wp-query.php
Lines:

1 to 12 of 12
  public function is_front_page() {
    // Most likely case.
    if ( 'posts' === get_option( 'show_on_front' ) && $this->WP_Query::is_home() ) {
      return true;
    } elseif ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' )
      && $this->WP_Query::is_page( get_option( 'page_on_front' ) )
    ) {
      return true;
    } else {
      return false;
    }
  }
 

 View on GitHub View on Trac