Make WordPress Core

Changeset 34769


Ignore:
Timestamp:
10/02/2015 06:45:32 AM (9 years ago)
Author:
DrewAPicture
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/nav-menu.php

    r33734 r34769  
    434434        if ( ! $menu_item_db_id || is_wp_error( $menu_item_db_id ) )
    435435            return $menu_item_db_id;
     436
     437        /**
     438         * Fires immediately after a new navigation menu item has been added.
     439         *
     440         * @since 4.4.0
     441         *
     442         * @see wp_update_nav_menu_item()
     443         *
     444         * @param int   $menu_id         ID of the updated menu.
     445         * @param int   $menu_item_db_id ID of the new menu item.
     446         * @param array $args            An array of arguments used to update/add the menu item.
     447         */
     448        do_action( 'wp_add_nav_menu_item', $menu_id, $menu_item_db_id, $args );
    436449    }
    437450
Note: See TracChangeset for help on using the changeset viewer.