_wp_check_split_terms_in_menus

The timeline below displays how wordpress function _wp_check_split_terms_in_menus has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Checks menu items when a term gets split to see if any of them need to be updated.
 *
 * @ignore
 * @since 4.2.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int    $term_id          ID of the formerly shared term.
 * @param int    $new_term_id      ID of the new term created for the $term_taxonomy_id.
 * @param int    $term_taxonomy_id ID for the term_taxonomy row affected by the split.
 * @param string $taxonomy         Taxonomy for the split term.
 */
function _wp_check_split_terms_in_menus($term_id, $new_term_id, $term_taxonomy_id, $taxonomy)
{
    global $wpdb;
    $post_ids = $wpdb->get_col($wpdb->prepare("SELECT m1.post_id\n\t\tFROM {$wpdb->postmeta} AS m1\n\t\t\tINNER JOIN {$wpdb->postmeta} AS m2 ON ( m2.post_id = m1.post_id )\n\t\t\tINNER JOIN {$wpdb->postmeta} AS m3 ON ( m3.post_id = m1.post_id )\n\t\tWHERE ( m1.meta_key = '_menu_item_type' AND m1.meta_value = 'taxonomy' )\n\t\t\tAND ( m2.meta_key = '_menu_item_object' AND m2.meta_value = %s )\n\t\t\tAND ( m3.meta_key = '_menu_item_object_id' AND m3.meta_value = %d )", $taxonomy, $term_id));
    if ($post_ids) {
        foreach ($post_ids as $post_id) {
            update_post_meta($post_id, '_menu_item_object_id', $new_term_id, $term_id);
        }
    }
}

WordPress Version: 4.9

/**
 * Check menu items when a term gets split to see if any of them need to be updated.
 *
 * @ignore
 * @since 4.2.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int    $term_id          ID of the formerly shared term.
 * @param int    $new_term_id      ID of the new term created for the $term_taxonomy_id.
 * @param int    $term_taxonomy_id ID for the term_taxonomy row affected by the split.
 * @param string $taxonomy         Taxonomy for the split term.
 */
function _wp_check_split_terms_in_menus($term_id, $new_term_id, $term_taxonomy_id, $taxonomy)
{
    global $wpdb;
    $post_ids = $wpdb->get_col($wpdb->prepare("SELECT m1.post_id\n\t\tFROM {$wpdb->postmeta} AS m1\n\t\t\tINNER JOIN {$wpdb->postmeta} AS m2 ON ( m2.post_id = m1.post_id )\n\t\t\tINNER JOIN {$wpdb->postmeta} AS m3 ON ( m3.post_id = m1.post_id )\n\t\tWHERE ( m1.meta_key = '_menu_item_type' AND m1.meta_value = 'taxonomy' )\n\t\t\tAND ( m2.meta_key = '_menu_item_object' AND m2.meta_value = %s )\n\t\t\tAND ( m3.meta_key = '_menu_item_object_id' AND m3.meta_value = %d )", $taxonomy, $term_id));
    if ($post_ids) {
        foreach ($post_ids as $post_id) {
            update_post_meta($post_id, '_menu_item_object_id', $new_term_id, $term_id);
        }
    }
}

WordPress Version: 4.4

/**
 * Check menu items when a term gets split to see if any of them need to be updated.
 *
 * @ignore
 * @since 4.2.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param int    $term_id          ID of the formerly shared term.
 * @param int    $new_term_id      ID of the new term created for the $term_taxonomy_id.
 * @param int    $term_taxonomy_id ID for the term_taxonomy row affected by the split.
 * @param string $taxonomy         Taxonomy for the split term.
 */
function _wp_check_split_terms_in_menus($term_id, $new_term_id, $term_taxonomy_id, $taxonomy)
{
    global $wpdb;
    $post_ids = $wpdb->get_col($wpdb->prepare("SELECT m1.post_id\n\t\tFROM {$wpdb->postmeta} AS m1\n\t\t\tINNER JOIN {$wpdb->postmeta} AS m2 ON ( m2.post_id = m1.post_id )\n\t\t\tINNER JOIN {$wpdb->postmeta} AS m3 ON ( m3.post_id = m1.post_id )\n\t\tWHERE ( m1.meta_key = '_menu_item_type' AND m1.meta_value = 'taxonomy' )\n\t\t\tAND ( m2.meta_key = '_menu_item_object' AND m2.meta_value = '%s' )\n\t\t\tAND ( m3.meta_key = '_menu_item_object_id' AND m3.meta_value = %d )", $taxonomy, $term_id));
    if ($post_ids) {
        foreach ($post_ids as $post_id) {
            update_post_meta($post_id, '_menu_item_object_id', $new_term_id, $term_id);
        }
    }
}

WordPress Version: 4.3

/**
 * Check menu items when a term gets split to see if any of them need to be updated.
 *
 * @ignore
 * @since 4.2.0
 *
 * @global wpdb $wpdb
 *
 * @param int    $term_id          ID of the formerly shared term.
 * @param int    $new_term_id      ID of the new term created for the $term_taxonomy_id.
 * @param int    $term_taxonomy_id ID for the term_taxonomy row affected by the split.
 * @param string $taxonomy         Taxonomy for the split term.
 */
function _wp_check_split_terms_in_menus($term_id, $new_term_id, $term_taxonomy_id, $taxonomy)
{
    global $wpdb;
    $post_ids = $wpdb->get_col($wpdb->prepare("SELECT m1.post_id\n\t\tFROM {$wpdb->postmeta} AS m1\n\t\t\tINNER JOIN {$wpdb->postmeta} AS m2 ON ( m2.post_id = m1.post_id )\n\t\t\tINNER JOIN {$wpdb->postmeta} AS m3 ON ( m3.post_id = m1.post_id )\n\t\tWHERE ( m1.meta_key = '_menu_item_type' AND m1.meta_value = 'taxonomy' )\n\t\t\tAND ( m2.meta_key = '_menu_item_object' AND m2.meta_value = '%s' )\n\t\t\tAND ( m3.meta_key = '_menu_item_object_id' AND m3.meta_value = %d )", $taxonomy, $term_id));
    if ($post_ids) {
        foreach ($post_ids as $post_id) {
            update_post_meta($post_id, '_menu_item_object_id', $new_term_id, $term_id);
        }
    }
}

WordPress Version: 4.2

/**
 * Check menu items when a term gets split to see if any of them need to be updated.
 *
 * @ignore
 * @since 4.2.0
 *
 * @param int    $term_id          ID of the formerly shared term.
 * @param int    $new_term_id      ID of the new term created for the $term_taxonomy_id.
 * @param int    $term_taxonomy_id ID for the term_taxonomy row affected by the split.
 * @param string $taxonomy         Taxonomy for the split term.
 */
function _wp_check_split_terms_in_menus($term_id, $new_term_id, $term_taxonomy_id, $taxonomy)
{
    global $wpdb;
    $post_ids = $wpdb->get_col($wpdb->prepare("SELECT m1.post_id\n\t\tFROM {$wpdb->postmeta} AS m1\n\t\t\tINNER JOIN {$wpdb->postmeta} AS m2 ON ( m2.post_id = m1.post_id )\n\t\t\tINNER JOIN {$wpdb->postmeta} AS m3 ON ( m3.post_id = m1.post_id )\n\t\tWHERE ( m1.meta_key = '_menu_item_type' AND m1.meta_value = 'taxonomy' )\n\t\t\tAND ( m2.meta_key = '_menu_item_object' AND m2.meta_value = '%s' )\n\t\t\tAND ( m3.meta_key = '_menu_item_object_id' AND m3.meta_value = %d )", $taxonomy, $term_id));
    if ($post_ids) {
        foreach ($post_ids as $post_id) {
            update_post_meta($post_id, '_menu_item_object_id', $new_term_id, $term_id);
        }
    }
}