From a3ead57e90fd44c8eed5a0158c4d52057966f8b5 Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Fri, 2 Oct 2015 06:46:24 +0000 Subject: [PATCH] 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 --- wp-includes/nav-menu.php | 13 +++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/wp-includes/nav-menu.php b/wp-includes/nav-menu.php index 90d0cbfd76..9cce24fbff 100644 --- a/wp-includes/nav-menu.php +++ b/wp-includes/nav-menu.php @@ -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 diff --git a/wp-includes/version.php b/wp-includes/version.php index 13e7ecd19b..0eee2d9bdc 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.