comment_author_url_link()
Outputs the author's comment URL as a link.
The URL is specified when publishing the comment and is usually the web page or site of the commenter.
This template tag should be used within the Comments Loop or the WordPress Loop.
No Hooks.
Returns
null.
Usage
<?php comment_author_url_link($linktext, $before, $after); ?>
- $linktext(string)
- The link text (anchor).
Default: Author's comment URL - $before(string)
- Text before the link.
Default: '' - $after(string)
- Text after the link.
Default: '' - $comment(int/WP_Comment)
- ID or object of the comment whose author's link needs to be retrieved. Since version 4.6.
Default: 0 (current comment)
Examples
#1 A simple example of how to use it:
Website: <?php comment_author_url_link(); ?>
#2 Display the link to the commenter's site and Styling
Displays comment author’s URL as text string "Visit Site of Comment Author" and adds bullets before and after the link to style it.
<?php comment_author_url_link( 'Visit Site of Comment Author', ' • ', ' • '); ?>
We get:
• <a href='https://example.com/' rel='external'>Visit Site of Comment Author</a> •
Changelog
| Since 0.71 | Introduced. |
| Since 4.6.0 | Added the $comment parameter. |
comment_author_url_link() comment author url link code WP 7.0
function comment_author_url_link( $link_text = '', $before = '', $after = '', $comment = 0 ) {
echo get_comment_author_url_link( $link_text, $before, $after, $comment );
}