Title: get_comment_author_url_link
Published: April 25, 2014
Last modified: August 20, 2026

---

# get_comment_author_url_link( string $link_text = '', string $before = '', string $after = '', int|WP_Comment $comment ): string

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/get_comment_author_url_link/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/get_comment_author_url_link/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/get_comment_author_url_link/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_comment_author_url_link/?output_format=md#source)
 * [Hooks](https://developer.wordpress.org/reference/functions/get_comment_author_url_link/?output_format=md#hooks)
 * [Related](https://developer.wordpress.org/reference/functions/get_comment_author_url_link/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_comment_author_url_link/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/get_comment_author_url_link/?output_format=md#wp--skip-link--target)

Retrieves the HTML link of the URL of the author of the current comment.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/get_comment_author_url_link/?output_format=md#description)󠁿

$link_text parameter is only used if the URL does not exist for the comment author.
If the URL does exist then the URL will be used and the $link_text will be ignored.

Encapsulate the HTML link between the $before and $after. So it will appear in the
order of $before, link, and finally $after.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/get_comment_author_url_link/?output_format=md#parameters)󠁿

 `$link_text`stringoptional

The text to display instead of the comment author’s email address.

Default:`''`

`$before`stringoptional

The text or HTML to display before the email link.

Default:`''`

`$after`stringoptional

The text or HTML to display after the email link.

Default:`''`

`$comment`int|[WP_Comment](https://developer.wordpress.org/reference/classes/wp_comment/)
optional

Comment ID or [WP_Comment](https://developer.wordpress.org/reference/classes/wp_comment/)
object.
 Default is the current comment.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_comment_author_url_link/?output_format=md#return)󠁿

 string The HTML link between the $before and $after parameters.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/get_comment_author_url_link/?output_format=md#source)󠁿

    ```php
    function get_comment_author_url_link( $link_text = '', $before = '', $after = '', $comment = 0 ) {
    	$comment_author_url = get_comment_author_url( $comment );

    	$display = ( '' !== $link_text ) ? $link_text : $comment_author_url;
    	$display = str_replace( 'http://www.', '', $display );
    	$display = str_replace( 'http://', '', $display );

    	if ( str_ends_with( $display, '/' ) ) {
    		$display = substr( $display, 0, -1 );
    	}

    	$comment_author_url_link = $before . sprintf(
    		'<a href="%1$s" rel="external">%2$s</a>',
    		$comment_author_url,
    		$display
    	) . $after;

    	/**
    	 * Filters the comment author's returned URL link.
    	 *
    	 * @since 1.5.0
    	 *
    	 * @param string $comment_author_url_link The HTML-formatted comment author URL link.
    	 */
    	return apply_filters( 'get_comment_author_url_link', $comment_author_url_link );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/comment-template.php#L433)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/comment-template.php#L433-L458)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/get_comment_author_url_link/?output_format=md#hooks)󠁿

 [apply_filters( ‘get_comment_author_url_link’, string $comment_author_url_link )](https://developer.wordpress.org/reference/hooks/get_comment_author_url_link/)

Filters the comment author’s returned URL link.

## 󠀁[Related](https://developer.wordpress.org/reference/functions/get_comment_author_url_link/?output_format=md#related)󠁿

| Uses | Description | 
| [get_comment_author_url()](https://developer.wordpress.org/reference/functions/get_comment_author_url/)`wp-includes/comment-template.php` |

Retrieves the URL of the author of the current comment, not linked.

  | 
| [apply_filters()](https://developer.wordpress.org/reference/functions/apply_filters/)`wp-includes/plugin.php` |

Calls the callback functions that have been added to a filter hook.

  |

| Used by | Description | 
| [comment_author_url_link()](https://developer.wordpress.org/reference/functions/comment_author_url_link/)`wp-includes/comment-template.php` |

Displays the HTML link of the URL of the author of the current comment.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_comment_author_url_link/?output_format=md#changelog)󠁿

| Version | Description | 
| [4.6.0](https://developer.wordpress.org/reference/since/4.6.0/) | Added the `$comment` parameter. | 
| [1.5.0](https://developer.wordpress.org/reference/since/1.5.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_comment_author_url_link%2F)
before being able to contribute a note or feedback.