WordPress at Your Fingertips
function is not described

_wp_check_split_terms_in_menus() WP 4.2.0

Check menu items when a term gets split to see if any of them need to be updated.

This is an internal function for using it by WP core itself. It's not recommended to use this function in your code.

No Hooks.


null. Nothing.


_wp_check_split_terms_in_menus( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy );
$term_id(int) (required)
ID of the formerly shared term.
$new_term_id(int) (required)
ID of the new term created for the $term_taxonomy_id.
$term_taxonomy_id(int) (required)
ID for the term_taxonomy row affected by the split.
$taxonomy(string) (required)
Taxonomy for the split term.


  • Global. wpdb. $wpdb WordPress database abstraction object.


Since 4.2.0 Introduced.

Code of _wp_check_split_terms_in_menus() WP 5.8

function _wp_check_split_terms_in_menus( $term_id, $new_term_id, $term_taxonomy_id, $taxonomy ) {
	global $wpdb;
	$post_ids = $wpdb->get_col(
			"SELECT m1.post_id
		FROM {$wpdb->postmeta} AS m1
			INNER JOIN {$wpdb->postmeta} AS m2 ON ( m2.post_id = m1.post_id )
			INNER JOIN {$wpdb->postmeta} AS m3 ON ( m3.post_id = m1.post_id )
		WHERE ( m1.meta_key = '_menu_item_type' AND m1.meta_value = 'taxonomy' )
			AND ( m2.meta_key = '_menu_item_object' AND m2.meta_value = %s )
			AND ( m3.meta_key = '_menu_item_object_id' AND m3.meta_value = %d )",

	if ( $post_ids ) {
		foreach ( $post_ids as $post_id ) {
			update_post_meta( $post_id, '_menu_item_object_id', $new_term_id, $term_id );