Fair enough. Thousands and thousands of entries, I have not seen. In my instance, it only had maybe 400 entries, and was cleaned up in under a few seconds.
Here is alternative code which does the same operation without making a database call for every single entry.
<?php
function clear_bad_cron_entries() {
// Fix incorrect cron entries for term splitting
$cron_array = _get_cron_array();
if ( isset( $cron_array['wp_batch_split_terms'] ) ) {
unset( $cron_array['wp_batch_split_terms'] );
_set_cron_array( $cron_array );
}
}
clear_bad_cron_entries();
Try this one instead if you're having problems with the first one. Note that the first one does work, but yes, it will cause lots of SQL to be run to fix the issue. This one does the same thing in one pass, with only one SQL statement.