is_front_page

Is the query for the front page of the site?.

Description

is_front_page(); 

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 is_home()


Usage

  1. if ( !function_exists( 'is_front_page' ) ) { 
  2. require_once ABSPATH . WPINC . '/query.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = is_front_page(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/query.php  
  1. function is_front_page() { 
  2. global $wp_query; 
  3.  
  4. if ( ! isset( $wp_query ) ) { 
  5. _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); 
  6. return false; 
  7.  
  8. return $wp_query->is_front_page();