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. git-svn-id: https://develop.svn.wordpress.org/trunk@35118 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
f9094e546a
commit
77e2cd9e18
|
@ -98,12 +98,19 @@ function add_permastruct( $name, $struct, $args = array() ) {
|
||||||
*/
|
*/
|
||||||
function add_feed( $feedname, $function ) {
|
function add_feed( $feedname, $function ) {
|
||||||
global $wp_rewrite;
|
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;
|
$wp_rewrite->feeds[] = $feedname;
|
||||||
|
}
|
||||||
|
|
||||||
$hook = 'do_feed_' . $feedname;
|
$hook = 'do_feed_' . $feedname;
|
||||||
|
|
||||||
// Remove default function hook
|
// Remove default function hook
|
||||||
remove_action( $hook, $hook );
|
remove_action( $hook, $hook );
|
||||||
add_action($hook, $function, 10, 1);
|
|
||||||
|
add_action( $hook, $function, 10, 2 );
|
||||||
|
|
||||||
return $hook;
|
return $hook;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue