From cba3b3d41cb5b7e1266b176029c3aa8e2b59abcf Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 13 Mar 2009 21:58:18 +0000 Subject: [PATCH] get_comment_link filter. Props Viper007Bond. fixes #9327 git-svn-id: http://svn.automattic.com/wordpress/trunk@10778 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-template.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index 5e626a4830..0af482fe68 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -442,7 +442,7 @@ function comment_ID() { * * @param object|string|int $comment Comment to retrieve. * @param array $args Optional args. - * @return string The permalink to the current comment + * @return string The permalink to the given comment. */ function get_comment_link( $comment = null, $args = array() ) { global $wp_rewrite, $in_comment_loop; @@ -472,12 +472,14 @@ function get_comment_link( $comment = null, $args = array() ) { $args['page'] = ( !empty($in_comment_loop) ) ? get_query_var('cpage') : get_page_of_comment( $comment->comment_ID, $args ); if ( $wp_rewrite->using_permalinks() ) - return user_trailingslashit( trailingslashit( get_permalink( $comment->comment_post_ID ) ) . 'comment-page-' . $args['page'], 'comment' ) . '#comment-' . $comment->comment_ID; + $link = user_trailingslashit( trailingslashit( get_permalink( $comment->comment_post_ID ) ) . 'comment-page-' . $args['page'], 'comment' ); else - return add_query_arg( 'cpage', $args['page'], get_permalink( $comment->comment_post_ID ) ) . '#comment-' . $comment->comment_ID; + $link = add_query_arg( 'cpage', $args['page'], get_permalink( $comment->comment_post_ID ) ); } else { - return get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID; + $link = get_permalink( $comment->comment_post_ID ); } + + return apply_filters( 'get_comment_link', $link . '#comment-' . $comment->comment_ID, $comment, $args ); } /**