WordPress.org

Make WordPress Core

Ticket #43429: 43429.diff

File 43429.diff, 1.5 KB (added by SergeyBiryukov, 16 months ago)
  • src/wp-includes/comment-template.php

     
    943943 *
    944944 * @since 1.5.0
    945945 * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
     946 * @since 5.3.0 Added 'In reply to %s.' prefix to child comments in comments feed.
    946947 *
    947948 * @see Walker_Comment::comment()
    948949 *
     
    954955function get_comment_text( $comment_ID = 0, $args = array() ) {
    955956        $comment = get_comment( $comment_ID );
    956957
     958        $comment_content = $comment->comment_content;
     959
     960        if ( is_comment_feed() && $comment->comment_parent ) {
     961                $parent = get_comment( $comment->comment_parent );
     962                if ( $parent ) {
     963                        $parent_link = esc_url( get_comment_link( $parent ) );
     964                        $name        = get_comment_author( $parent );
     965
     966                        $comment_content = sprintf(
     967                                /* translators: %s: comment link */
     968                                ent2ncr( __( 'In reply to %s.' ) ),
     969                                '<a href="' . $parent_link . '">' . $name . '</a>'
     970                        ) . "\n\n" . $comment_content;
     971                }
     972        }
     973
    957974        /**
    958975         * Filters the text of a comment.
    959976         *
     
    965982         * @param WP_Comment $comment         The comment object.
    966983         * @param array      $args            An array of arguments.
    967984         */
    968         return apply_filters( 'get_comment_text', $comment->comment_content, $comment, $args );
     985        return apply_filters( 'get_comment_text', $comment_content, $comment, $args );
    969986}
    970987
    971988/**