From ae9ce0ccd7c51725d248e5a6144aabbfcaaf5275 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 13 Oct 2015 02:59:24 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@35118 git-svn-id: http://core.svn.wordpress.org/trunk@35083 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/rewrite-functions.php | 15 +++++++++++---- wp-includes/version.php | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/wp-includes/rewrite-functions.php b/wp-includes/rewrite-functions.php index ef8846a36f..5c9003d2f8 100644 --- a/wp-includes/rewrite-functions.php +++ b/wp-includes/rewrite-functions.php @@ -96,14 +96,21 @@ function add_permastruct( $name, $struct, $args = array() ) { * @param callable $function Callback to run on feed display. * @return string Feed action name. */ -function add_feed($feedname, $function) { +function add_feed( $feedname, $function ) { global $wp_rewrite; - if ( ! in_array($feedname, $wp_rewrite->feeds) ) //override the file if it is + + if ( ! in_array( $feedname, $wp_rewrite->feeds ) ) { + // Override the file if it is $wp_rewrite->feeds[] = $feedname; + } + $hook = 'do_feed_' . $feedname; + // Remove default function hook - remove_action($hook, $hook); - add_action($hook, $function, 10, 1); + remove_action( $hook, $hook ); + + add_action( $hook, $function, 10, 2 ); + return $hook; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 691aab1c6f..16ebacd0f3 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-35117'; +$wp_version = '4.4-alpha-35118'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.