From 695644cc7268691c8bb58c858f90250ee3a4d1ee Mon Sep 17 00:00:00 2001 From: nacin Date: Thu, 18 Nov 2010 03:19:08 +0000 Subject: [PATCH] Allow is_feed() to drill down the feed being checked. props johnbillion for initial patch, fixes #15460. git-svn-id: http://svn.automattic.com/wordpress/trunk@16447 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/query.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/wp-includes/query.php b/wp-includes/query.php index 8855748ebc..64fa8e3b82 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -309,12 +309,13 @@ function is_day() { * @since 1.5.0 * @uses $wp_query * + * @param string|array $feeds Optional feed types to check. * @return bool */ -function is_feed() { +function is_feed( $feeds = '' ) { global $wp_query; - return $wp_query->is_feed(); + return $wp_query->is_feed( $feeds ); } /** @@ -2936,10 +2937,16 @@ class WP_Query { * * @since 3.1.0 * + * @param string|array $feeds Optional feed types to check. * @return bool */ - function is_feed() { - return (bool) $this->is_feed; + 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 ); } /**