Removing & disabling all trackbacks

Published: On Sunday, January 3, 2010

If you find trackbacks on your WordPress site useless or even annoying, this simple manual how to kill 'em all is going to help you.

How to…

  1. go to Administration → Plugins → Add new, add WordPress Database Backup and backup your database in Tools → Backup
  2. add WordPress Console plugin
  3. In Tools → Console call following codes:
    • var_dump($wpdb->query("UPDATE wp_posts SET ping_status = 'closed'")); to close all posts' trackbacks (you should see result like int(321) – the number of modified posts)
    • var_dump($wpdb->query("UPDATE wp_comments SET comment_approved = '0' WHERE comment_type IN ('pingback', 'trackback')")); – to make all trackbacks unapproved (you'll see them in Administration → Comments → Pending)
    • and optionally delete these directly: var_dump($wpdb->query("DELETE FROM wp_comments WHERE comment_type IN ('pingback', 'trackback')"));
    • If you're still in the console, it might be good time to remove all spam comments: var_dump($wpdb->query("DELETE FROM wp_comments WHERE comment_approved = 'spam'"));

Note: Remember to replace wp_ prefix with your own, if you're using custom one.

Why to…

I'm completely convinced that trackbacks (or pingbacks – basically the same thing) bring no benefit for my readers. It possibly might be different in case of your site – but I don't believe so. Although the idea behind trackbacks is nice, it obviously isn't working. Why it isn't working, that's other topic.


Comments

  1. 1.  Kahi [author] wrote: On March 19., 2010 comment number 1

    By the way, to remove revisions, run var_dump($wpdb->query("DELETE FROM wp_posts WHERE post_type = 'revision'"));

I quit working with WordPress, comments are closed. My plugins will not be updated any more – at least not by me. Feel free to modify my source codes though… Also I am not able to provide support, sorry. –Kahi