Action hook 'wp_update_nav_menu'

in WP Core File wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php at line 456

View Source

wp_update_nav_menu

Action Hook
Description
Updates the menu's auto add from a REST request.

Hook Information

File Location wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php View on GitHub
Hook Type Action
Line Number 456

Hook Parameters

Type Name Description
int $menu_id The menu id to update.
WP_REST_Request $request Full details about the request.

Usage Examples

Basic Usage
<?php
// Hook into wp_update_nav_menu
add_action('wp_update_nav_menu', 'my_custom_function', 10, 2);

function my_custom_function($menu_id, $request) {
    // Your custom code here
}

Source Code Context

wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php:456 - How this hook is used in WordPress core
<?php
 451  		}
 452  
 453  		$update = update_option( 'nav_menu_options', $nav_menu_option );
 454  
 455  		/** This action is documented in wp-includes/nav-menu.php */
 456  		do_action( 'wp_update_nav_menu', $menu_id );
 457  
 458  		return $update;
 459  	}
 460  
 461  	/**

PHP Documentation

<?php
/**
	 * Updates the menu's auto add from a REST request.
	 *
	 * @since 5.9.0
	 *
	 * @param int             $menu_id The menu id to update.
	 * @param WP_REST_Request $request Full details about the request.
	 * @return bool True if the auto add setting was successfully updated.
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 2
  • File: wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php
Related Hooks

Related hooks will be displayed here in future updates.