Stop Pingback/Trackback Spam on WordPress
Wednesday, September 7th, 2011
I guess the spammers finally found my blog, cause I've been getting a lot of pignback/trackback spam. I tried some anti-spam plugins, but none really worked, so I disabled pingbacks altogether. Here's how:
First, log into wordpress as an admin. Go to Settings → Discussion, and uncheck the Allow link notifications from other blogs (pingbacks and trackbacks.) box.
That's not all though, cause that just works for new articles. Old ones will still allow ping/trackbacks. As far as I could tell, WordPress doesn't have a feature to disable those for older posts, so we'll have to fiddle around in the database directly.
Connect to your MySQL server using the WordPress username and password. If you no longer remember those, you can find them in the wp-config.php file.
$ mysql -u USERNAME -p -h localhost Password: PASSWORD Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1684228 Server version: 5.0.51a-24+lenny5 (Debian) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>
At the MySQL prompt, we must now switch to our WordPress database. Again, if you don't remember the name, you can find it in the wp-config.php file. In my case, it is em_wordpress
mysql> USE em_wordpress; Database changed
Finally, we update all posts and disable ping backs on them:
mysql> UPDATE wp_posts SET ping_status = 'closed'; Query OK, 1084 rows affected (0.10 sec) Rows matched: 1084 Changed: 1084 Warnings: 0
There we go. No more ping- and trackback spam on old posts.