Advertisements

do_feed

Loads the feed template from the use of an action hook.
If the feed action does not have a hook, then the function will die with a message telling the visitor that the feed is not valid.

Defined actions

  • $hook
    do_action( $hook, $wp_query->is_comment_feed );

Source code

function do_feed() {

	global $wp_query;



	$feed = get_query_var( 'feed' );



	// Remove the pad, if present.

	$feed = preg_replace( '/^_+/', '', $feed );



	if ( $feed == '' || $feed == 'feed' )

		$feed = get_default_feed();



	$hook = 'do_feed_' . $feed;

	if ( !has_action($hook) ) {

		$message = sprintf( __( 'ERROR: %s is not a valid feed template.' ), esc_html($feed));

		wp_die( $message, '', array( 'response' => 404 ) );

	}



	do_action( $hook, $wp_query->is_comment_feed );

}

956

Advertisements

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 )

Google+ photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s

%d bloggers like this: