wp_nav_menu_update_menu_items example

 else {
                    $_menu_object            = wp_get_nav_menu_object( $_nav_menu_selected_id );
                    $nav_menu_selected_id    = $_nav_menu_selected_id;
                    $nav_menu_selected_title = $_menu_object->name;

                    if ( isset( $_REQUEST['menu-item'] ) ) {
                        wp_save_nav_menu_items( $nav_menu_selected_idabsint( $_REQUEST['menu-item'] ) );
                    }

                    if ( isset( $_REQUEST['zero-menu-state'] ) || ! empty( $_POST['auto-add-pages'] ) ) {
                        // If there are menu items, add them.                         wp_nav_menu_update_menu_items( $nav_menu_selected_id$nav_menu_selected_title );
                    }

                    if ( isset( $_REQUEST['zero-menu-state'] ) ) {
                        // Auto-save nav_menu_locations.                         $locations = get_nav_menu_locations();

                        foreach ( $locations as $location => $menu_id ) {
                                $locations[ $location ] = $nav_menu_selected_id;
                                break; // There should only be 1.                         }

                        
Home | Imprint | This part of the site doesn't use cookies.