WP_Query::is_feed()publicWP 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 6.4.1

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

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

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