WordPress.org

Make WordPress Core

Ticket #43429: 43429.2.diff

File 43429.2.diff, 1.7 KB (added by imath, 9 months ago)
  • src/wp-includes/comment-template.php

    diff --git src/wp-includes/comment-template.php src/wp-includes/comment-template.php
    index a031c9a88c..207a53a64e 100644
    function get_comments_number_text( $zero = false, $one = false, $more = false ) 
    949949 *
    950950 * @since 1.5.0
    951951 * @since 4.4.0 Added the ability for `$comment_ID` to also accept a WP_Comment object.
     952 * @since 5.4.0 Added 'In reply to %s.' prefix to child comments in comments feed.
    952953 *
    953954 * @see Walker_Comment::comment()
    954955 *
    function get_comments_number_text( $zero = false, $one = false, $more = false ) 
    960961function get_comment_text( $comment_ID = 0, $args = array() ) {
    961962        $comment = get_comment( $comment_ID );
    962963
     964        $comment_content = $comment->comment_content;
     965
     966        if ( is_comment_feed() && $comment->comment_parent ) {
     967                $parent = get_comment( $comment->comment_parent );
     968                if ( $parent ) {
     969                        $parent_link = esc_url( get_comment_link( $parent ) );
     970                        $name        = get_comment_author( $parent );
     971
     972                        $comment_content = sprintf(
     973                                /* translators: %s: comment link */
     974                                ent2ncr( __( 'In reply to %s.' ) ),
     975                                '<a href="' . $parent_link . '">' . $name . '</a>'
     976                        ) . "\n\n" . $comment_content;
     977                }
     978        }
     979
    963980        /**
    964981         * Filters the text of a comment.
    965982         *
    function get_comment_text( $comment_ID = 0, $args = array() ) { 
    971988         * @param WP_Comment $comment         The comment object.
    972989         * @param array      $args            An array of arguments.
    973990         */
    974         return apply_filters( 'get_comment_text', $comment->comment_content, $comment, $args );
     991        return apply_filters( 'get_comment_text', $comment_content, $comment, $args );
    975992}
    976993
    977994/**