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
- Removing website URL in comments causes misalignment of submit button and tickbox
- Can I use ‘Featured Image’ as a hero image and a thumbnail?
- How to Override Page Template if URL matches query?
- Probleme shortcode with list author
- how to check if an element in an html file exists in another html file? [closed]
- Save_post – Warning: Cannot modify header information
- Writing a function for WP Cron to run a SQL command daily
- What is the earliest Hook a Script can use?
- removing description tabs – single product page – breaks footer
- How do I trigger WP CLI DB export using a PHP function?
- Add Javascript code to functions.php childtheme
- Populate acf-field, depending on block name
- How to use WP conditional tag in a functions.php with OCEANWP Theme?
- If has action not working as expected
- Update wp_postmeta table based on 2 keys
- Best practice to call a function from a button-link?
- WordPress does not load jQuery
- Disable wordpress update notification
- How Can I Create a Friendly Slug for a Dynamic Page?
- Link product attribute value to a URL – woocommerce
- Google Analytics – add script to functions.php
- custom error message for empty username and password using authenticate filter not working
- Class parameter in get_avatar args doesn’t get added to output
- How to display replies to his comments in user profile of current user
- Deleting guests profile users after 1.5 hours
- Remove check boxes and its label from screen option for custom role
- get variables data from functions.php to template wordpress (without global variables)
- How to show a list of comments on home page from all posts?
- Removing comment lines from all enqueued js files using a filter function
- Modifying a WordPress Plugin
- ACF Flexible in TCPDF
- Function to function shortcode help [closed]
- Last updated posts shortcode in functions.php
- wp enqueue style on about us page
- CF7 select value get to function and reciept value from function
- reply comment below the comment box without reload page
- wp_get_current_user return ID = 0 when used outside of wordpress, such as webhook / fulfillment dialogflow
- Fatal error: Call to undefined function load_theme_textdomain() in /var/www/vhosts/61/151172/webspace/httpdocs/wp-includes/functions.php on line 5
- large image size of 1440×1440 not pulling 2x of 2880×2880 image
- Hide author info in single posts by certain users
- How to reference different css (bootstrap) stylesheets for the header and body of a page?
- Creating a custom functions page wordpress
- Remove text after a dot and a colon in Woocommerce product title
- sort title descending with title with number
- Delete oldest wordpress post (SQL query)
- Add #primary at the end of navlink permalinks on single posts
- search and replace using regex
- post value to function with Ajax and jQuery
- When are the user meta fields created in the database? Admin vs Woo API REST
- Selecting specific query for offset