Seems pretty much simple:
add_filter( 'get_comment_author_link', 'attach_city_to_author' );
function attach_city_to_author( $author ) {
$city = get_comment_meta( get_comment_ID(), 'city', true );
if ( $city ) $author = $city;
return $author;
}
Unless if you are adding the city name somewhere else and wanted to remove comment author name then call add_filter('get_comment_author', '__return_false');
Hope that helps.
Related Posts:
- Comments to only be seen by their author
- Change the HTML of the comment form that is generating somewhere from the core WordPress
- How do I make the comment disappear after deleting from the database?
- Comment function for page
- Increase Comment Author Gravatar Size On WordPress Default Comment Function
- Undo a function that is not (seemingly) hooked to an action?
- Getting full code of wp_list_comments instead of replacing it
- Remove Comments Metabox but still allow comments
- How can I remove the title “leave a reply” in the comment box in twentyeleven?
- change the comment time output to: X time ago instead of actual date and time
- How to get comments with mixed status using get_comments?
- How to prevent deleting of comments when deleting a post
- disable comments if array exists
- Remove “says” from comments
- Display the number of user comments
- How do I change parameters without changing the core
- How to Add a Random Custom Gravatar in the WordPress Comments?
- Show top commenters without using a plugin
- Commenter should see only his comments in wordpress
- Filter out other users comments. Visualize only own comments and editor role users’ comments
- wp-comment author- url +, email filter hook
- Where to add the permalink in this function?
- Incorrect redirect after commenting
- comments_popup_link without echo?
- Getting comment count per post not working
- Wp admin – Set default value to 999 in comments
- What is the Difference in bones_comments() and comments.php
- Function to replace comment’s accented characters before posting
- WordPress comment_form() does not display actual comments
- WordPress comment processing . Default unapproved comments detection before posting
- How do I change where “You must be logged in to comment” directs users?
- Why isn’t comment validation working?
- Remove nofollow from internal comment links via functions.php
- How can I automatically delete comments that contain a URL?
- Warning and fatal error
- I want to change the WordPress comments file
- How to identify author in wordpress comments?
- Newest comments first not working
- get_comments not working properly after WordPress v4.4 update
- Getting error while trying to use custom comment function
- Custom Nested WordPress Comments with avatar
- Comment Function
- WP Custom Comment Callback Not Responding
- How to remove “login to reply” from individual comments [duplicate]
- Comment turned Invisible
- User’s Comments Number: Storing it in a meta field for different uses
- Add functionality to block comment authors in the Comment edit pag
- Remove “Category:”, “Tag:”, “Author:” from the_archive_title
- get_template_directory_uri pointing to parent theme not child theme
- Link to user’s profile settings page?
- Shared functions.php across multiple WordPress websites
- AJAX handler throws 400 (Bad request) – why?
- Return only top-level navigation items from a menu using wp_get_nav_menu_items
- How to add .htaccess code through a function?
- Conditional tag is_page with a custom post type
- customize comment form
- How do I create comment-reply-button using element not
- Theme options WP Editor
- Enqueue styles after a plugin
- Properly applying nonce to a form using AJAX
- What is the $context in remove_meta_box function?
- Conditions for Users and Visitors
- how to get the comment ID in the front end when the REPLY button is clicked?
- add_filter priority problem
- Super simple shortcode not working
- Using “Read More” link with custom excerpt
- Enqueue scripts not working with if is page conditional tag in functions.php
- what function can I use to automatically output og tags per page/post?
- Why does the ‘wp_nav_menu’ function work only until a menu is created?
- Add error message on password protected page ONLY when password introduced was incorrect
- Parse error after modifying the template menu [closed]
- Reuse variable in hook callback
- What does this code do? (Injected code hacked)
- Pass parameter to hooked function using custom page template
- Is my code correct to enqueue CSS on a specific page?
- WordPress function only executes once
- Dequeue Script Using Functions.php
- Using $WPDB to create simple array to check against user entered value
- Create custom function for hero image
- Custom comment field not showing when logged-in
- Remove a Plugin function through theme’s function.php?
- If is_single in functions.php
- How to conditionally add a widget via a hook in functions.php
- Unescape attribute the_title() on CDATA in RSS feed
- get_image_tag() html output : empty src attribute
- Warning at top of website & top menu gone
- How to add custom metakey to shop_order page’s searching function?
- Show ‘Add to Cart’ on Out of Stock products
- Pass post ID from archive template to functions file
- Competing Login Redirects – Need to be Combined?
- How to add styles in existing function?
- What add_action reference should I be using or should I use do_action?
- Allow the access over wp-login.php
- Create input select image URL?
- Including one page with WordPress functions into another
- Dynamically Generating User Meta Field
- Check if there is an post to be published in future
- Unhook the comment form in Buddypress
- is_preview() always return false
- Get all users from role and add to dropdown (select) – wordpress, javascript