![]() |
Removing existing comment IPs.
I currently see no way to do this. I might need to export, edit all the IPs from the XML file then import.
See also the Remove IP WordPress plugin.
I don’t know how to remove old comment IPs. I found a post with some hints:
was web.archive.org/web/20220811234420/https://cygery.com/wordpress/2012/08/17/wordpress-delete-author-ip-addresses-of-old-comments/ (removed!)
#!/bin/sh \echo "\ UPDATE wp_comments \ SET comment_author_IP='0.0.0.0' \ WHERE comment_author_IP != '0.0.0.0' \ AND TIMESTAMPDIFF(DAY, comment_date, CURRENT_TIMESTAMP) >= 7;" |\ \mysql --defaults-file=/home/<username>/.my.cnf <wordpress database name>
This script executes a SQL command which checks the timestamp and the author’s IP address of all comments in the comments table (wp_comments).
- If a comment is older than seven days and its IP address is not 0.0.0.0 it’ll be set so.
- The
--defaults-file=/home/<username>/.my.cnfis needed because when the script is called byrunwhen. Themysqlcommand won’t find the user’s.my.cnffile without this option. -
In this file the MySQL user password is saved.
Note that the IP addresses might still be stored in backups of the database or emails send to you by WordPress.
(source)
It’d be great if someone with experience in writing WordPress plugins would implement this small SQL command in a plugin so users wouldn’t need to deal with
runwhenetc.

