get_comment_author_url

Retrieve the url of the author of the current comment.

Description

(string) get_comment_author_url( (int) $comment_ID = 0 ); 

Returns (string)

Comment author URL.

Parameters (1)

0. $comment_id — Optional. (int)
WP_Comment or the ID of the comment for which to get the author's URL.

Usage

  1. if ( !function_exists( 'get_comment_author_url' ) ) { 
  2. require_once ABSPATH . WPINC . '/comment-template.php'; 
  3.  
  4. // Optional. WP_Comment or the ID of the comment for which to get the author's URL. 
  5. // Default current comment. 
  6. $comment_id = -1; 
  7.  
  8. // NOTICE! Understand what this does before running. 
  9. $result = get_comment_author_url($comment_id); 
  10.  

Defined (1)

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

/wp-includes/comment-template.php  
  1. function get_comment_author_url( $comment_ID = 0 ) { 
  2. $comment = get_comment( $comment_ID ); 
  3. $url = ''; 
  4. $id = 0; 
  5. if ( ! empty( $comment ) ) { 
  6. $author_url = ( 'http://' == $comment->comment_author_url ) ? '' : $comment->comment_author_url; 
  7. $url = esc_url( $author_url, array( 'http', 'https' ) ); 
  8. $id = $comment->ID; 
  9.  
  10. /** 
  11. * Filters the comment author's URL. 
  12. * @since 1.5.0 
  13. * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added. 
  14. * @param string $url The comment author's URL. 
  15. * @param int $comment_ID The comment ID. 
  16. * @param WP_Comment $comment The comment object. 
  17. */ 
  18. return apply_filters( 'get_comment_author_url', $url, $id, $comment );