Simple solution drop this in your functions.php
function your_get_comment_author_link () {
global $comment;
if ($comment->user_id == '0') {
if (!empty ($comment->comment_author_url)) {
$url = $comment->comment_author_url;
} else {
$url="#";
}
} else {
$url = get_author_posts_url($comment->user_id);
}
echo "<a href=\"" . $url . "\">" .get_comment_author () . "</a>";
}
If the user is registered this will link to /writer/username
, if they are not it will either link to their url or to #
if they haven’t provided one.
Obviously to use it you’ll want use it in your code using
<span><?php your_get_comment_author_link() ?></span>
Taken from Johan suggestion in comments.
Related Posts:
- Display all comments or recent comments per user on author page
- List user comments in author page
- Commenting in user profile page?
- Change Comment Author Display Name
- Display Authors Comments on Profile Page
- Check If comment author is registered
- WordPress: How to get the current logged in author page URL?
- Show content only if member left a comment
- Comment Author Name In Reply Form
- How to auto-approve internal pingbacks?
- Post comment as different user than logged in
- Number of External Links in Comments – Moderation Option
- Remove link preview in discussion dashboard
- how to make author to write comment on only his own posts?
- Authors Page : A page of authors
- Get most active users sort by comment count
- Add delete, approve, spam Links to Comments
- How to check if commenter is the_author?
- WordPress comments email notification for authors
- Let user edit his own comment
- edit comments capability for authors
- List User Comments on User Profile BuddyPress [closed]
- How to create a link to jump to “Leave a comment” part?
- Hold comments for moderation only if user is not logged in
- Why are authors allowed to approve comments on their posts? How to revoke privilege?
- Display WordPress commenter nice name
- Changing the comments link produced by the get_comments_link() and get_comments_pagenum_link() functions
- Check if someone recently commented in one of my posts
- Hide notifications regarding new comments
- Highlighting the current users comment
- Display the number of unseen comments on a page since the user last visit
- Author can only see own post comment and can moderate
- WordPress comments on users profile
- Comment displaying full name even after setting another display name?
- Same email for all comments
- Notify post author for a new comment on his post?
- Allow the comment author to delete their own comments
- cancel reply link results in 404 error
- Create Next and Previous Link to User orderby Last Name
- All users/comments suspected as bot? [closed]
- Comments on Author page
- Showing author page if user has no post
- Commenting in user profile page?
- I wish to remove, disable or hide the comment authors’ links to their sites from my home page
- if user role is then echo text
- Remove the deleted user comment
- Anonymize comments after one year
- How can I get list of emails of users who commented on a post?
- Best way to tell if a comment is from a user?
- How many members have made comments approved for an article?
- Commentlist: bypostauthor problem with children list
- Remove Comment Author Link only for subscribers
- Author comment count in author page
- Only Allow post author and “Premium” Role user to comment
- Custom comment field not showing when logged-in
- Get Comment Author ID on the fly while posting
- Modify links in user comments
- Problem in getting user comments permalinks
- How can I hide comment of the authors from their published posts?
- Show all people who commented on all posts by an author
- Is there a way to link to the BOTTOM of the comments on a wordpress page?
- WordPress Custom Local Avatar not showing in comments
- Attaching author tag to the comment
- Change author base and slug in author link
- How to prevent users/authors from seing IP/email of new commentators?
- Author name length character limit?
- Comments counter only for Authors Posts
- wp list all users who haven’t commented on a post
- I want to limit registered user to 1 comment per post in WordPress
- Comments pagination on author page
- Change author, disable comments, enable trackbacks for all items in library
- Allowing comments on author pages
- Let user delete comment on front end only
- Prevent author from editing comments from others in their post
- URLs to user page is broken
- How to ‘If Author’ Comments Check
- selectively disable akismet
- Author page link in comments is different than in posts?
- Auto approve all comments (editor)
- How to display comments by logged in user and responses?
- Deleting users do not deletes coments
- delete user not working
- Disable Link to Post from Showing Up in Post’s Comments?
- One comment per user per post but be able to reply to existing comments
- What’s the easiest way to close comments on media/attachments?
- Comment pagination – How to show determined number of comments on the first page?
- Sort comments by karma
- Create comments.php form of custom HTML code
- To whom do emails get sent via the WordPress comments form?
- I want to allow the use of a data-flw attribute in links in comments
- warnCommentChanges always being triggered on update
- how get comments only on post of current logged in user?
- Extra Title field for Comments
- Comments offset
- Order users by user role
- Add comment_meta to wp_comment_reply
- How do comments work?
- How to use filter on comment submission/insert
- Custom comment types. Are they a possibility?
- How to add a comment box on wordpress page? in the discussion section of page, allow comments is checked