Source View: rss2_head

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
196      <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
197      <generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator>
198      <language><?php echo get_option('rss_language'); ?></language>
199 <?php if ( $cats ) : foreach ( $cats as $c ) : ?>
200      <wp:category><wp:category_nicename><?php echo $c->slug; ?></wp:category_nicename><wp:category_parent><?php echo $c->parent ? $cats[$c->parent]->name : ''; ?></wp:category_parent><?php wxr_cat_name($c); ?><?php wxr_category_description($c); ?></wp:category>
201 <?php endforeach; endif; ?>
202 <?php if ( $tags ) : foreach ( $tags as $t ) : ?>
203      <wp:tag><wp:tag_slug><?php echo $t->slug; ?></wp:tag_slug><?php wxr_tag_name($t); ?><?php wxr_tag_description($t); ?></wp:tag>
204 <?php endforeach; endif; ?>
205      <?php do_action('rss2_head'); ?>
206      <?php if ($post_ids) {
207           global $wp_query;
208           $wp_query->in_the_loop = true;  // Fake being in the loop.
209           // fetch 20 posts at a time rather than loading the entire table into memory
210           while ( $next_posts = array_splice($post_ids, 0, 20) ) {
211                $where = "WHERE ID IN (".join(',', $next_posts).")";
212                $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
213                     foreach ($posts as $post) {
214                setup_postdata($post); ?>