Uses
Uses | Description |
---|---|
wp-includes/plugin.php: remove_action() | Removes a function from a specified action hook. |
wp-includes/plugin.php: add_action() | Hooks a function on to a specific action. |
Add a new feed type like /atom1/.
(string) (Required) Feed name.
(callable) (Required) Callback to run on feed display.
(string) Feed action name.
Requires one-time use of flush_rules() to take effect.
File: wp-includes/rewrite.php
function add_feed( $feedname, $function ) { global $wp_rewrite; if ( ! in_array( $feedname, $wp_rewrite->feeds, true ) ) { $wp_rewrite->feeds[] = $feedname; } $hook = 'do_feed_' . $feedname; // Remove default function hook. remove_action( $hook, $hook ); add_action( $hook, $function, 10, 2 ); return $hook; }
Version | Description |
---|---|
2.1.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/add_feed