WordPress.org

Make WordPress Core

Ticket #9327: 9327.patch

File 9327.patch, 1.6 KB (added by Viper007Bond, 9 years ago)
  • wp-includes/comment-template.php

     
    442442 *
    443443 * @param object|string|int $comment Comment to retrieve.
    444444 * @param array $args Optional args.
    445  * @return string The permalink to the current comment
     445 * @return string The permalink to the given comment.
    446446 */
    447447function get_comment_link( $comment = null, $args = array() ) {
    448448        global $wp_rewrite, $in_comment_loop;
     
    472472                        $args['page'] = ( !empty($in_comment_loop) ) ? get_query_var('cpage') : get_page_of_comment( $comment->comment_ID, $args );
    473473
    474474                if ( $wp_rewrite->using_permalinks() )
    475                         return user_trailingslashit( trailingslashit( get_permalink( $comment->comment_post_ID ) ) . 'comment-page-' . $args['page'], 'comment' ) . '#comment-' . $comment->comment_ID;
     475                        $link = user_trailingslashit( trailingslashit( get_permalink( $comment->comment_post_ID ) ) . 'comment-page-' . $args['page'], 'comment' );
    476476                else
    477                         return add_query_arg( 'cpage', $args['page'], get_permalink( $comment->comment_post_ID ) ) . '#comment-' . $comment->comment_ID;
     477                        $link = add_query_arg( 'cpage', $args['page'], get_permalink( $comment->comment_post_ID ) );
    478478        } else {
    479                 return get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID;
     479                $link = get_permalink( $comment->comment_post_ID );
    480480        }
     481
     482        return apply_filters( 'get_comment_link', $link . '#comment-' . $comment->comment_ID, $comment, $args );
    481483}
    482484
    483485/**