add_feed

Definition:
function add_feed($feedname, $function) {}

Add a new feed type like /atom1/.

Parameters

  • string $feedname
  • callback $function: Callback to run on feed display.

Return values

returns:Feed action name.

Source code

function add_feed($feedname, $function) {

	global $wp_rewrite;

	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, 10, 1);

	add_action($hook, $function, 10, 1);

	return $hook;

}

345

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: