Execute: Move Stand With Israel Under Partners
This snippet executes immediately to move the Stand With Israel menu item under Partners.
get_results(
"SELECT ID, post_parent FROM {$wpdb->posts}
WHERE post_type = 'nav_menu_item'
AND post_parent = 52046
LIMIT 1"
);
if (!empty($stand_israel_items)) {
$stand_item_id = $stand_israel_items[0]->ID;
// Find Partners menu item - it's a page with title 'Partners'
$partners_page = $wpdb->get_row(
"SELECT ID FROM {$wpdb->posts}
WHERE post_type = 'page'
AND post_title LIKE '%Partners%'
AND post_status = 'publish'
LIMIT 1"
);
if ($partners_page) {
// Find the menu item for Partners
$partners_items = $wpdb->get_results(
$wpdb->prepare(
"SELECT ID FROM {$wpdb->posts}
WHERE post_type = 'nav_menu_item'
AND meta_value = %d
LIMIT 1",
$partners_page->ID
),
ARRAY_A
);
if (!empty($partners_items)) {
$partners_item_id = $partners_items[0]['ID'];
// Update the menu item parent
$wpdb->update(
$wpdb->posts,
array('post_parent' => $partners_item_id),
array('ID' => $stand_item_id),
array('%d'),
array('%d')
);
// Also update the meta field
update_post_meta($stand_item_id, '_menu_item_menu_item_parent', $partners_item_id);
// Log success
error_log('✓ Successfully moved Stand With Israel under Partners menu');
}
}
}
?>



