wp_create_nav_menu
Action HookDescription
Fires after a navigation menu is successfully created.Hook Information
File Location |
wp-includes/nav-menu.php
View on GitHub
|
Hook Type | Action |
Line Number | 375 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$term_id
|
ID of the new menu. |
array
|
$menu_data
|
An array of menu data. |
Usage Examples
Basic Usage
<?php
// Hook into wp_create_nav_menu
add_action('wp_create_nav_menu', 'my_custom_function', 10, 2);
function my_custom_function($term_id, $menu_data) {
// Your custom code here
}
Source Code Context
wp-includes/nav-menu.php:375
- How this hook is used in WordPress core
<?php
370 * @since 3.0.0
371 *
372 * @param int $term_id ID of the new menu.
373 * @param array $menu_data An array of menu data.
374 */
375 do_action( 'wp_create_nav_menu', $_menu['term_id'], $menu_data );
376
377 return (int) $_menu['term_id'];
378 }
379
380 if ( ! $_menu || ! isset( $_menu->term_id ) ) {
PHP Documentation
<?php
/**
* Fires after a navigation menu is successfully created.
*
* @since 3.0.0
*
* @param int $term_id ID of the new menu.
* @param array $menu_data An array of menu data.
*/
Quick Info
- Hook Type: Action
- Parameters: 2
- File: wp-includes/nav-menu.php
Related Hooks
Related hooks will be displayed here in future updates.