Make WordPress Core

Changeset 35118


Ignore:
Timestamp:
10/13/2015 02:58:21 AM (9 years ago)
Author:
SergeyBiryukov
Message:

Feeds: Pass the second parameter of "do_feed_{$feed}" action, feed name, to callbacks added via add_feed().

The $feed parameter was added in [35115].

Props slimndap.
See #34259.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rewrite-functions.php

    r34946 r35118  
    9797 * @return string Feed action name.
    9898 */
    99 function add_feed($feedname, $function) {
    100     global $wp_rewrite;
    101     if ( ! in_array($feedname, $wp_rewrite->feeds) ) //override the file if it is
     99function add_feed( $feedname, $function ) {
     100    global $wp_rewrite;
     101
     102    if ( ! in_array( $feedname, $wp_rewrite->feeds ) ) {
     103        // Override the file if it is
    102104        $wp_rewrite->feeds[] = $feedname;
     105    }
     106
    103107    $hook = 'do_feed_' . $feedname;
     108
    104109    // Remove default function hook
    105     remove_action($hook, $hook);
    106     add_action($hook, $function, 10, 1);
     110    remove_action( $hook, $hook );
     111
     112    add_action( $hook, $function, 10, 2 );
     113
    107114    return $hook;
    108115}
Note: See TracChangeset for help on using the changeset viewer.