I came across a situation where I had to go through my WordPress database to update the URL information for one of my frequent commenters in light of his new domain name. Rather than modifying each of his comments one by one, I sought a single database query which would reflect the update.All I had to do was go into CPanel, open up phpMyAdmin, select my WordPress database, select the “Query” tab, and then input the following query:
UPDATE `WP-database-name`.`wp_comments` SET `comment_author_url` = 'new-URL' WHERE `wp_comments`.`comment_author` ="commentator-name"
For example, let’s say that user “Guest” has been posting comments for months and finally got a domain name of his own, https://guest.com. If I wanted to append this URL to all his previous comments, I would run the following query on this site.
UPDATE `rishikum_sswp03`.`wp_comments` SET `comment_author_url` = 'https://guest.com' WHERE `wp_comments`.`comment_author` ="Guest"
In essence, I’m telling phpMyAdmin to “update” my WordPress comments table by setting the new URL, https://guest.com, for every entry where the author was named “Guest.”
This process can be extended to other criteria as well. For example, let’s say that a commentrator has been using multiple “names” but the exact same e-mail address whenever he/she posted on your site. You can go through the database, select all instances of that e-mail address, and set a desired user name.
This sure simplifies life. 🙂