is_embed

函式
is_embed ( No parameters )
返回值
  • (bool) Whether the query is for an embedded post.
定義位置
相關方法
is_feedis_timeis_homeis_termis_iterable
引入
4.4.0
棄用
-

is_embed: 如果當前頁面是一個嵌入的文章或頁面,該函式返回真。嵌入的文章或頁面是一個顯示在另一個頁面或文章中的內容,如YouTube視訊或社交媒體文章。

查詢的是一個嵌入式的文章嗎?

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

常見問題

FAQs
檢視更多 >