How can I delete all my existing trackbacks?

I’m sorting out a long-neglected wordpress.org blog. It has over 100,000 pieces of trackback spam. How can I remove them all?

Related posts

Leave a Reply

2 comments

  1. To make this more WP-ish:

    function wpse_delete_trackbacks()
    {
        global $wpdb;
    
        $wpdb->query( $wpdb->prepare(
            "
                DELETE FROM %s WHERE `comment_type` = 'trackback'
            ",
            "{$wpdb->prefix}comments"
        ) );
    }
    
  2. I gave up on finding an elegant solution and just used a MySQL sledgehammer to banish the spam:

    DELETE FROM `wp_comments` WHERE `comment_type`="trackback"