WordPress.org

Make WordPress Core

Ticket #5493: search_comments_feed_fix.patch

File search_comments_feed_fix.patch, 1.7 KB (added by ionfish, 7 years ago)
  • wp-includes/feed-atom-comments.php

     
    1111                if ( is_singular() ) 
    1212                        printf(__('Comments on: %s'), get_the_title_rss()); 
    1313                elseif ( is_search() ) 
    14                         printf(__('Comments for %s searching on %s'), get_bloginfo_rss( 'name' ), attribute_escape($wp_query->query_vars['s'])); 
     14                        printf(__('Comments for %1$s searching on %2$s'), get_bloginfo_rss( 'name' ), attribute_escape(get_search_query())); 
    1515                else 
    1616                        printf(__('Comments for %s'), get_bloginfo_rss( 'name' ) . get_wp_title_rss()); 
    1717        ?></title> 
     
    2121        <?php the_generator( 'atom' ); ?> 
    2222         
    2323<?php if ( is_singular() ) { ?> 
    24         <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo get_comments_link() ?>" /> 
     24        <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo get_comments_link(); ?>" /> 
    2525        <link rel="self" type="application/atom+xml" href="<?php echo get_post_comments_feed_link('', 'atom'); ?>" /> 
    2626        <id><?php echo get_post_comments_feed_link('', 'atom'); ?></id> 
     27<?php } elseif(is_search()) { ?> 
     28        <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php echo get_option('home') . '?s=' . attribute_escape(get_search_query()); ?>" /> 
     29        <link rel="self" type="application/atom+xml" href="<?php echo get_search_comments_feed_link('', 'atom'); ?>" /> 
     30        <id><?php echo get_search_comments_feed_link('', 'atom'); ?></id> 
    2731<?php } else { ?> 
    2832        <link rel="alternate" type="<?php bloginfo_rss('html_type'); ?>" href="<?php bloginfo_rss('home'); ?>" /> 
    2933        <link rel="self" type="application/atom+xml" href="<?php bloginfo_rss('comments_atom_url'); ?>" />