is_comment_feed

函式
is_comment_feed ( No parameters )
返回值
  • (bool) Whether the query is for a comments feed.
定義位置
相關方法
post_comments_feed_linkcomments_link_feedcomment_idthe_content_feedget_comment_id
引入
3.0.0
棄用
-

is_comment_feed: 這個函式檢查當前頁面是否是一個評論源。評論源是一個顯示特定文章評論的RSS源的頁面。如果當前頁面是一個評論源,它返回true,否則返回false。

查詢的是評論feed嗎?

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

常見問題

FAQs
檢視更多 >