WordPress.org

Make WordPress Core

Ticket #9611: 9611.diff

File 9611.diff, 1.6 KB (added by solarissmoke, 7 years ago)
  • wp-includes/functions.php

     
    17181718 * If the feed action does not have a hook, then the function will die with a
    17191719 * message telling the visitor that the feed is not valid.
    17201720 *
     1721 * If the request is for a comment feed for a post on which comments/pings are closed
     1722 * then the function will die with status code 410
     1723 *
    17211724 * It is better to only have one hook for each feed.
    17221725 *
    17231726 * @since 2.1.0
     
    17401743                $message = sprintf( __( 'ERROR: %s is not a valid feed template.' ), esc_html($feed));
    17411744                wp_die( $message, '', array( 'response' => 404 ) );
    17421745        }
     1746       
     1747        if( is_comment_feed() && is_singular() && ! comments_open() && ! pings_open() )
     1748                wp_die( __('The feed you requested is no longer available because comments on the associated article are closed.' ), '', array( 'response' => 410 ) );
    17431749
    17441750        do_action( $hook, $wp_query->is_comment_feed );
    17451751}
  • wp-includes/general-template.php

     
    16421642        if ( is_single() || is_page() ) {
    16431643                $post = &get_post( $id = 0 );
    16441644
    1645                 if ( comments_open() || pings_open() || $post->comment_count > 0 ) {
     1645                if ( comments_open() || pings_open() ) {
    16461646                        $title = esc_attr(sprintf( $args['singletitle'], get_bloginfo('name'), $args['separator'], esc_html( get_the_title() ) ));
    16471647                        $href = get_post_comments_feed_link( $post->ID );
    16481648                }