Skip to content

Instantly share code, notes, and snippets.

@peterwilsoncc
Created August 9, 2022 01:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterwilsoncc/6862384dbdf19085de50f6aef3b5dff7 to your computer and use it in GitHub Desktop.
Save peterwilsoncc/6862384dbdf19085de50f6aef3b5dff7 to your computer and use it in GitHub Desktop.
<?php
/**
* Prevent the term splitting job from being fired.
*/
add_filter(
'pre_schedule_event',
function( $pre, $event ) {
if ( $event->hook === 'wp_split_shared_term_batch' ) {
return false;
}
return $pre;
},
10,
2
);
if ( ! term_exists( 'pw-unsplit-term' ) ) {
$wpdb->insert(
$wpdb->terms,
array(
'name' => 'PW Unsplit term',
'slug' => 'pw-unsplit-term',
)
);
$term_id = $wpdb->insert_id;
$wpdb->insert(
$wpdb->term_taxonomy,
array(
'term_id' => $term_id,
'taxonomy' => 'post_tag',
'parent' => 0,
'count' => 0,
)
);
$wpdb->insert(
$wpdb->term_taxonomy,
array(
'term_id' => $term_id,
'taxonomy' => 'category',
'parent' => 0,
'count' => 0,
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment