is_favicon

函式
is_favicon ( No parameters )
返回值
  • (bool) Whether the query is for the favicon.ico file.
定義位置
相關方法
do_faviconis_admindid_actionhas_actionis_info
引入
5.4.0
棄用
-

is_favicon: 如果當前頁面是網站的favicon,該函式返回true。favicon是出現在瀏覽器標籤或位址列中網站名稱旁邊的小圖示。

查詢的是favicon.ico檔案嗎?

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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();
}
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(); }
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();
}

常見問題

FAQs
檢視更多 >