Make WordPress Core


Ignore:
Timestamp:
06/07/2021 09:48:29 PM (3 years ago)
Author:
joedolson
Message:

Comments: Return valid comment reply link if comments are paginated.

Fix the link returned by get_comment_reply_link() so the link points to the correct page of comments when links are paginated. While this link is normally overridden by the comment-reply script, if that script is disabled, the link would point to a location that did not exist when comments were paginated.

props MrPauloEn, paaggeli, alexstine, engahmeds3ed.
Fixes #51189.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment-template.php

    r49936 r51081  
    16481648 * @since 2.7.0
    16491649 * @since 4.4.0 Added the ability for `$comment` to also accept a WP_Comment object.
    1650  *
     1650 * 
    16511651 * @param array          $args {
    16521652 *     Optional. Override default arguments.
     
    17071707    }
    17081708
     1709    if ( get_option( 'page_comments' ) ) {
     1710        $permalink = str_replace( '#comment-' . $comment->comment_ID, '', get_comment_link( $comment ) );
     1711    } else {
     1712        $permalink = get_permalink( $post->ID );
     1713    }
     1714
    17091715    /**
    17101716     * Filters the comment reply link arguments.
     
    17511757                        'moderation-hash' => false,
    17521758                    ),
    1753                     get_permalink( $post->ID )
     1759                    $permalink
    17541760                )
    17551761            ) . '#' . $args['respond_id'],
Note: See TracChangeset for help on using the changeset viewer.