Sci/Tech

Changing WordPress Commenter Information

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. 🙂

Tags

Related Posts

5 Comments

  1. Appreciate it buddy! Wish I had your 4+ years of experience with WordPress and of tweaking the CSS code. Lol. I will definitely mold the site into into something much better than what it is now, just need time. 😉

    1. You, of course. 🙂 Your site’s credibility will improve if sites which already have credibility link to it. By leaving a URL with your comment, search engines “see” it as a link from this site to your main site. Since you left so many comments in the past, I thought I should extend you the courtesy of going ahead and updating all of them to reflect your new site.

Leave a Reply

Your email address will not be published. Required fields are marked *

Close