WP_Query::is_feed( string|string[] $feeds =  ): bool

In this article

Determines whether the query is for a feed.

Parameters

$feedsstring|string[]optional
Feed type or array of feed types to check against.

Default:''

Return

bool Whether the query is for a feed.

Source

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 );
}

Changelog

VersionDescription
3.1.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.