After some search for solving this problem i found the correct answer for solving this problem in update meta box values specially in checkbox a little bit different from other Html input tags such us text , select tags
when we use update_post_meta
box values for checked
checkbox. must in the same time we use update_post_meta
for unchecking of checkbox value
i solved my problem such as below. only i deleted post meta when i uncheck the checkbox value
function YPE_update_custom_fields($menu_id, $menu_item_db_id, $menu_item_data) {
if (is_array($_REQUEST['menu-item-divider'])) {
$YPE_divider_value = ;
update_post_meta($menu_item_db_id, '_menu_item_divider', $_REQUEST['menu-item-divider'][$menu_item_db_id]);
} else {
delete_post_meta($menu_item_db_id, '_menu_item_divider');
}
add_action('wp_update_nav_menu_item', 'YPE_update_custom_fields', 10, 3);