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
- comments_template() doesn’t work with ajax call
- How to use: WP_AJAX_GET_COMMENTS
- WP backend, Show only own comments (give to users who wrote/published/assigned) posts
- Adding a second email address to a completed order in WooCommerce [closed]
- Possible to search by author name with default WordPress search function?
- How can I limit the number of comments per registered user per day?
- Is it possible to override this function/class in a child theme?
- When new user register then add new user role
- Change meta tags programatically
- Remove bulk actions based on user role or capabilities
- Set first oembed in post to a global variable or function
- Adding extra SVGs to TwentyNineteen child theme using class TwentyNineteen_SVG_Icons
- Use a function to update post meta based on other post meta
- Adding body class when post contains a specific shortcode
- WordPress registration and contact form 7 [closed]
- PHP files included in functions.php don’t seem to work
- How To Remove Duplicate Menu Locations
- WordPress shortcode attributes for database SELECT?
- How to get membership level for specific user email
- Backstretch.js and thumbnail sizes to reduce loading time
- Child theme within a child theme?
- Featured Image Thumbnail Creation
- Updating Media Published Date When Parent Post Is Modified in WordPress
- WP Ajax Function Always Returning undefined
- How can I grab the video id of youtube?
- Creating A New Admin Menu Tab For Theme Options
- Passing variable as add_shortcode argument
- Load jquery only for certain pages in the backend
- Use html inside shortcode function
- Unable to return values from function
- processing form data with ajax
- How to convert raw url to hyperlink?
- Split single-review.php to two parts
- get content from page through AJAX
- The work of WordPress Function update_post
- Facebook OpenGraph error, Call to undefined function wp_get_attachment_src()
- how can I change all wordpress media file url to custom cdn url?
- Changing the HTML of notices in WooCommerce [closed]
- Is it possible to give a classname to specific comments in the WordPress admin?
- How to use WP conditional tag in a functions.php with OCEANWP Theme?
- How Can I Create a Friendly Slug for a Dynamic Page?
- How can i display pagination in custom comment list?
- function class doesnt work
- Load CSS file conditionally
- my wordpress doesn’t save items to customized widget area
- save_post doesn’t correctly process function call with php class
- Login functions
- Highlight only current on single pages
- Additional folder where will Media Library look for files
- How do I add schema markup to individual WordPress posts without using plugins?
- Bad value crossorigin for attribute crossorigin on element link
- Custom customizer CSS priority
- Custom HTML structure in customizer not rendring in Browser