Introduce the `wp_add_nav_menu_item` action, fired immediately after a new nav menu item has been added.

This hook can be leveraged both for the legacy menus interface and the menus integration in the Customizer, as both use the containing function, `wp_update_nav_menu_item()`.

Props MikeHansenMe, tyxla.
Fixes #30983.

Built from https://develop.svn.wordpress.org/trunk@34769


git-svn-id: http://core.svn.wordpress.org/trunk@34734 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Drew Jaynes 2015-10-02 06:46:24 +00:00
parent e6da469a20
commit a3ead57e90
2 changed files with 14 additions and 1 deletions

View File

@ -433,6 +433,19 @@ function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item
$menu_item_db_id = wp_insert_post( $post );
if ( ! $menu_item_db_id || is_wp_error( $menu_item_db_id ) )
return $menu_item_db_id;
/**
* Fires immediately after a new navigation menu item has been added.
*
* @since 4.4.0
*
* @see wp_update_nav_menu_item()
*
* @param int $menu_id ID of the updated menu.
* @param int $menu_item_db_id ID of the new menu item.
* @param array $args An array of arguments used to update/add the menu item.
*/
do_action( 'wp_add_nav_menu_item', $menu_id, $menu_item_db_id, $args );
}
// Associate the menu item with the menu term

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-34768';
$wp_version = '4.4-alpha-34769';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.