add_feed | Add a new feed type like /atom1/.
add_feed
Add a new feed type like /atom1/.
Description
Returns (string)
Feed action name.
Parameters (2)
- 0. $feedname (string)
- The feedname.
- 1. $function (callable)
- Callback to run on feed display.
Usage
if ( !function_exists( 'add_feed' ) ) { require_once ABSPATH . WPINC . '/rewrite.php'; } // The feedname. $feedname = ''; // Callback to run on feed display. $function = null; // NOTICE! Understand what this does before running. $result = add_feed($feedname, $function);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/rewrite.php
- function add_feed( $feedname, $function ) {
- global $wp_rewrite;
- if ( ! in_array( $feedname, $wp_rewrite->feeds ) ) {
- $wp_rewrite->feeds[] = $feedname;
- }
- $hook = 'do_feed_' . $feedname;
- // Remove default function hook
- remove_action( $hook, $hook );
- add_action( $hook, $function, 10, 2 );
- return $hook;
- }
No comments