WordPress.org

Make WordPress Core

Changeset 16447


Ignore:
Timestamp:
11/18/10 03:19:08 (7 years ago)
Author:
nacin
Message:

Allow is_feed() to drill down the feed being checked. props johnbillion for initial patch, fixes #15460.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/query.php

    r16438 r16447  
    310310 * @uses $wp_query 
    311311 * 
     312 * @param string|array $feeds Optional feed types to check. 
    312313 * @return bool 
    313314 */ 
    314 function is_feed() { 
    315     global $wp_query; 
    316  
    317     return $wp_query->is_feed(); 
     315function is_feed( $feeds = '' ) { 
     316    global $wp_query; 
     317 
     318    return $wp_query->is_feed( $feeds ); 
    318319} 
    319320 
     
    29372938     * @since 3.1.0 
    29382939     * 
     2940     * @param string|array $feeds Optional feed types to check. 
    29392941     * @return bool 
    29402942     */ 
    2941     function is_feed() { 
    2942         return (bool) $this->is_feed; 
     2943    function is_feed( $feeds = '' ) { 
     2944        if ( empty( $feeds ) || ! $this->is_feed ) 
     2945            return (bool) $this->is_feed; 
     2946        $qv = $this->get( 'feed' ); 
     2947        if ( 'feed' == $qv ) 
     2948            $qv = get_default_feed(); 
     2949        return in_array( $qv, (array) $feeds ); 
    29432950    } 
    29442951 
Note: See TracChangeset for help on using the changeset viewer.