is_favicon() WordPress Function

The is_favicon() function allows you to check if a given URL is a favicon. A favicon is a small icon that represents a website.

is_favicon() #

Is the query for the favicon.ico file?


Return

(bool) Whether the query is for the favicon.ico file.


Top ↑

Source

File: wp-includes/query.php

function is_favicon() {
	global $wp_query;

	if ( ! isset( $wp_query ) ) {
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
		return false;
	}

	return $wp_query->is_favicon();
}


Top ↑

Changelog

Changelog
VersionDescription
5.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.