diff --git a/wp-admin/nav-menus.php b/wp-admin/nav-menus.php index b26ccb545b..f1d04e8c36 100644 --- a/wp-admin/nav-menus.php +++ b/wp-admin/nav-menus.php @@ -300,6 +300,7 @@ switch ( $action ) { if ( ! is_wp_error( $_menu_object ) ) { $menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array('orderby' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID') ); $post_fields = array( 'menu-item-db-id', 'menu-item-object-id', 'menu-item-object', 'menu-item-parent-id', 'menu-item-position', 'menu-item-type', 'menu-item-append', 'menu-item-title', 'menu-item-url', 'menu-item-description', 'menu-item-attr-title', 'menu-item-target', 'menu-item-classes', 'menu-item-xfn' ); + wp_defer_term_counting(true); // Loop through all the menu items' POST variables if ( ! empty( $_POST['menu-item-db-id'] ) ) { foreach( (array) $_POST['menu-item-db-id'] as $_key => $k ) { @@ -330,6 +331,8 @@ switch ( $action ) { } } + wp_defer_term_counting(false); + do_action( 'wp_update_nav_menu', $nav_menu_selected_id ); $messages[] = '
' . sprintf( __('The %s menu has been updated.'), $nav_menu_selected_title ) . '