Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




do_feed [ WordPress Function ]

do_feed ( No parameters )
Uses:
Defined at:



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.

It is better to only have one hook for each feed.

Source


<?php
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 );
}
?>

Examples [ wp-snippets.com ]

Top Google Search Results

More ...

0 User Note(s)

None yet. Be the first!

Add New ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics