Created
August 9, 2022 01:15
-
-
Save peterwilsoncc/6862384dbdf19085de50f6aef3b5dff7 to your computer and use it in GitHub Desktop.
Testing mu-plugin for https://core.trac.wordpress.org/ticket/56351
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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