get_edit_comment_link

Retrieves the edit comment link.

Description

(string|void) get_edit_comment_link( (int) $comment_id = 0 ); 

Returns (string|void)

The edit comment link URL for the given comment.

Parameters (1)

0. $comment_id — Optional. (int)
Comment ID or WP_Comment object.

Usage

  1. if ( !function_exists( 'get_edit_comment_link' ) ) { 
  2. require_once ABSPATH . WPINC . '/link-template.php'; 
  3.  
  4. // Optional. Comment ID or WP_Comment object. 
  5. $comment_id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = get_edit_comment_link($comment_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/link-template.php  
  1. function get_edit_comment_link( $comment_id = 0 ) { 
  2. $comment = get_comment( $comment_id ); 
  3.  
  4. if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) 
  5. return; 
  6.  
  7. $location = admin_url('comment.php?action=editcomment&c=') . $comment->comment_ID; 
  8.  
  9. /** 
  10. * Filters the comment edit link. 
  11. * @since 2.3.0 
  12. * @param string $location The edit link. 
  13. */ 
  14. return apply_filters( 'get_edit_comment_link', $location );