WP_Query::is_feedpublicWP 3.1.0

Determines whether the query is for a feed.

Метод класса: WP_Query{}

Хуков нет.

Возвращает

true|false. Whether the query is for a feed.

Использование

global $wp_query;
$wp_query->is_feed( $feeds );
$feeds(строка|string[])
Feed type or array of feed types to check against.
По умолчанию: ''

Список изменений

С версии 3.1.0 Введена.

Код WP_Query::is_feed() WP 7.0.3

public function is_feed( $feeds = '' ) {
	if ( empty( $feeds ) || ! $this->is_feed ) {
		return (bool) $this->is_feed;
	}

	$query_var = $this->get( 'feed' );
	if ( 'feed' === $query_var ) {
		$query_var = get_default_feed();
	}

	return in_array( $query_var, (array) $feeds, true );
}