From d0ce9b88fa313bc5b8d2c2f4a8337bc0cd7fad69 Mon Sep 17 00:00:00 2001 From: Rachel Baker Date: Fri, 15 Apr 2016 20:58:24 +0000 Subject: [PATCH] Comments: Add parameters to `edit_comment_link()` to allow specifying a Comment and link class. Matches the parameters for `edit_post_link()`. Fixes #36538. Props flixos90. git-svn-id: https://develop.svn.wordpress.org/trunk@37215 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/link-template.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php index ef5bfdc67d..40727bd076 100644 --- a/src/wp-includes/link-template.php +++ b/src/wp-includes/link-template.php @@ -1402,13 +1402,16 @@ function get_edit_comment_link( $comment_id = 0 ) { * Displays the edit comment link with formatting. * * @since 1.0.0 + * @since 4.6.0 The `$comment` and `$class` arguments were added. * - * @param string $text Optional. Anchor text. - * @param string $before Optional. Display before edit link. - * @param string $after Optional. Display after edit link. + * @param string $text Optional. Anchor text. + * @param string $before Optional. Display before edit link. + * @param string $after Optional. Display after edit link. + * @param int|WP_Comment $comment Optional. Comment ID or WP_Comment object. + * @param string $class Optional. Add custom class to link. */ -function edit_comment_link( $text = null, $before = '', $after = '' ) { - $comment = get_comment(); +function edit_comment_link( $text = null, $before = '', $after = '', $comment = 0, $class = 'comment-edit-link' ) { + $comment = get_comment( $comment ); if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) { return; @@ -1418,7 +1421,7 @@ function edit_comment_link( $text = null, $before = '', $after = '' ) { $text = __( 'Edit This' ); } - $link = '' . $text . ''; + $link = '' . $text . ''; /** * Filters the comment edit link anchor tag.