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. Built from https://develop.svn.wordpress.org/trunk@37215 git-svn-id: http://core.svn.wordpress.org/trunk@37181 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
7c2ad56158
commit
a0eab11bc1
|
@ -1402,13 +1402,16 @@ function get_edit_comment_link( $comment_id = 0 ) {
|
||||||
* Displays the edit comment link with formatting.
|
* Displays the edit comment link with formatting.
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
|
* @since 4.6.0 The `$comment` and `$class` arguments were added.
|
||||||
*
|
*
|
||||||
* @param string $text Optional. Anchor text.
|
* @param string $text Optional. Anchor text.
|
||||||
* @param string $before Optional. Display before edit link.
|
* @param string $before Optional. Display before edit link.
|
||||||
* @param string $after Optional. Display after 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 = '' ) {
|
function edit_comment_link( $text = null, $before = '', $after = '', $comment = 0, $class = 'comment-edit-link' ) {
|
||||||
$comment = get_comment();
|
$comment = get_comment( $comment );
|
||||||
|
|
||||||
if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
|
if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
|
||||||
return;
|
return;
|
||||||
|
@ -1418,7 +1421,7 @@ function edit_comment_link( $text = null, $before = '', $after = '' ) {
|
||||||
$text = __( 'Edit This' );
|
$text = __( 'Edit This' );
|
||||||
}
|
}
|
||||||
|
|
||||||
$link = '<a class="comment-edit-link" href="' . esc_url( get_edit_comment_link( $comment ) ) . '">' . $text . '</a>';
|
$link = '<a class="' . esc_attr( $class ) . '" href="' . esc_url( get_edit_comment_link( $comment ) ) . '">' . $text . '</a>';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the comment edit link anchor tag.
|
* Filters the comment edit link anchor tag.
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.6-alpha-37214';
|
$wp_version = '4.6-alpha-37215';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue