A WordPress-centric search engine for devs and theme authors



add_feed ›

Since2.1.0
Deprecatedn/a
add_feed ( $feedname, $function )
Parameters: (2)
  • (string) $feedname Feed name.
    Required: Yes
  • (callable) $function Callback to run on feed display.
    Required: Yes
Returns:
  • (string) Feed action name.
Defined at:
Codex:

Add a new feed type like /atom1/.



Related Functions: do_feed, is_feed, add_filter, add_meta, add_user

Source

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;
}