On this page
WP_Query::is_feed( string|string[] $feeds = '' ): bool
Is the query 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
File: wp-includes/class-wp-query.php. View all references
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 );
}
Related
Uses
| Uses | Description |
|---|---|
| WP_Query::get() wp-includes/class-wp-query.php | Retrieves the value of a query variable. |
| get_default_feed() wp-includes/feed.php | Retrieves the default feed. |
Used By
| Used By | Description |
|---|---|
| WP_Query::generate_postdata() wp-includes/class-wp-query.php | Generate post data. |
| is_feed() wp-includes/query.php | Determines whether the query is for a feed. |
Changelog
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_query/is_feed