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);
Related Posts:
- add_menu_page() with different name for first submenu item
- How to add sub-menu to a menu generated by wp_nav_menu by using plugin
- Change the_title() of a page dynamically
- How do I programatically insert a new menu item?
- Add Dividers or Separators Between Nav Menu Items
- Nav Menu meta failing to import
- Overwriting Core WordPress Functions with Plugins
- Some nav-menu filters do nothing
- Determine which theme location a wp_get_nav_menu_items is for
- Can I add pages to my custom menu via script?
- Replacing WordPress menu functionality with a plugin
- Hook event for upload image in the menu
- Why isn’t the Settings API designed to work for plugins using custom admin menus? [duplicate]
- How do I approach removing menu items on the fly based on settings in my plugin?
- What is the difference between current_page_parent and current_page_ancestor?
- Delete a specific item menu when I deactivate my plugin
- Create a Page via plugin
- Add Submenu Link in add_submenu_page That Opens in a New Window
- How to assign a WP 3.0 custom nav menu to a theme’s navigation menu location via script?
- Header Button Chance Polylang Elementor
- PHP 7 – Class Method Compatibility Issue
- How to add pages to custom menus on the fly [duplicate]
- How do I add a custom sublevel menu specified in one directory to a custom top level menu specified in another directory?
- Add notification bubble notice in navigation using transients
- Get Current Menu Location inside Nav_Walker
- Sub Menu content is being duplicated
- Plugin menu addition in multisite
- Remove unwanted elements for a wp_nav_menu
- Is this best practice for Dynamically adding items to WordPress menus?
- How to remove or add submenu item on plugin activate or deactive
- Custom code for WordPress dynamic menu
- How do I access the menus produced by Dashboard > Appearance > Menus
- wordpress add_submenu_page adds broken link
- WP Enqueue style on all plug-in pages
- Add child pages to submenu automatically
- Customize existing menu item
- Menu page with minimum capability as ‘Subscriber’ doesn’t allow ‘Admin’ to access it?
- Issue with plugin sub menu and pages
- How to add Plugin functionality in WordPress Frontend Menus
- How to hide page links from theme menu
- WP_NAV_MENU filter targets all menus
- How do I add a menu item to a Pods admin menu?
- Add user managable titles to custom menus?
- How to create archive page to add in menu
- How to show only the last two categories in a menu?
- Always hide a page from the menu
- remove different admin menu for specific users
- How to get an array out of a nav menu if it’s a plugin?
- What happens when you create/edit a menu
- Plugin admin list pages as submenu
- Adding parent custom post type menu option
- Create and style menu
- Change the class of wordpress menu
- Invalid Menu Items
- Declaration of mandoe_menu_walker::start_el(&$output, $item, $depth, $args) must be compatible with Walker::start_el(…)
- Custom Nav Walker $item->url producing malformed hyperlinks
- Displaying an Uploaded Image as a Custom Avatar in WordPress
- Adding a navigation with wp_nav_menu() to a custom block in the site editor
- Where to store PHP files created by plugin / themes
- WordPress 4.5 deprecated get_currentuserinfo()
- Single Responsibility Principle and WP Classes
- How to control output of custom post type without modifying theme?
- Admin config screen without menu
- What is the added “complexity” of custom tables?
- How to exclude content (and other returned values) from WP_query()?
- Why does preg_replace_callback never fire in this function?
- WordPress select dropdown list in widget
- Call to undefined function get_blog_option()
- Unable to get content from $post on first publish
- Broken markup when using the_excerpt() in a widget?
- Gutenberg Block add element in the Editor inside InnerBlocks after div – editor-block-list
- How can I add a CSS rule to edit.php?
- How do you render_callback for register_block_type to a method in another class?
- Get the password key when using the wp_new_user_notification_email filter
- WordPress API have Plugin Anti-piracy feature?
- Customizer: widget-synced triggers twice
- Plugin Repo: Why do some plugins get version charts while others don’t?
- .mo translation strings not loading in PHP scripts that handle AJAX calls
- How to Debug: My Plugin Interferes With My Theme
- How to stop activation addon if the main plugin is not activated
- add_rewrite_rule behaving strangely
- Problem with context in multisite – getting main site data in every blog (get_pages())
- How do I change the image from the default mysteryman in the WP Profile page
- WordPress: How to rename the main php plugin base file?
- Is there any way to hide page from dashboard (all pages list) OR navbar from plugin function?
- How to check if `comment_meta` exists before inserting the comment?
- Showing results from json-string in WordPress search results page
- How to revive (or take over) a plugin?
- Make visible page only in the trash
- Reading plugin settings in esnext wordpress block
- Plugin frontend page design irrespective of the theme used
- add_meta_box does not display meta box in Admin
- How to store in the database directly the translation?
- What is the “best” way to update a theme via a plugin?
- Is there a an option to modify the post content directly on the browser instead of having it reflected on browser by modifying in the database?
- Acessing WP functions in form submission handler
- Custom theme and plugin updating
- Dynamic banner for use on external sites
- An adiitional function fires on my AJAX submit
- How to add something after a function