WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/15/2016 08:58:24 PM (4 years ago)
Author:
rachelbaker
Message:

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.

File:
1 edited

Legend:

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

    r37213 r37215  
    14031403 *
    14041404 * @since 1.0.0
    1405  *
    1406  * @param string $text   Optional. Anchor text.
    1407  * @param string $before Optional. Display before edit link.
    1408  * @param string $after  Optional. Display after edit link.
    1409  */
    1410 function edit_comment_link( $text = null, $before = '', $after = '' ) {
    1411     $comment = get_comment();
     1405 * @since 4.6.0 The `$comment` and `$class` arguments were added.
     1406 *
     1407 * @param string         $text    Optional. Anchor text.
     1408 * @param string         $before  Optional. Display before edit link.
     1409 * @param string         $after   Optional. Display after edit link.
     1410 * @param int|WP_Comment $comment Optional. Comment ID or WP_Comment object.
     1411 * @param string         $class   Optional. Add custom class to link.
     1412 */
     1413function edit_comment_link( $text = null, $before = '', $after = '', $comment = 0, $class = 'comment-edit-link' ) {
     1414    $comment = get_comment( $comment );
    14121415
    14131416    if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) {
     
    14191422    }
    14201423
    1421     $link = '<a class="comment-edit-link" href="' . esc_url( get_edit_comment_link( $comment ) ) . '">' . $text . '</a>';
     1424    $link = '<a class="' . esc_attr( $class ) . '" href="' . esc_url( get_edit_comment_link( $comment ) ) . '">' . $text . '</a>';
    14221425
    14231426    /**
Note: See TracChangeset for help on using the changeset viewer.