Make WordPress Core

Changeset 23897


Ignore:
Timestamp:
04/04/2013 04:28:12 AM (11 years ago)
Author:
nacin
Message:

Remove _wp_delete_nav_menu(). wp_delete_nav_menu() should instead remove the menu from theme locations, which was the only difference between the functions. see #23119.

Location:
trunk
Files:
3 edited

Legend:

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

    r23808 r23897  
    12071207
    12081208/**
    1209  * Delete nav menus from the nav menu management screen
    1210  *
    1211  * @since 3.6.0
    1212  * @access private
    1213  *
    1214  * @param int|string $nav_menu_id The menu to delete (id, slug, or name)
    1215  * @return false if Error, otherwise true
    1216  */
    1217 function _wp_delete_nav_menu( $nav_menu_id ) {
    1218 
    1219     if ( ! is_nav_menu( $nav_menu_id ) )
    1220         return;
    1221 
    1222     $deleted_nav_menu = wp_get_nav_menu_object( $nav_menu_id );
    1223     $delete_nav_menu = wp_delete_nav_menu( $nav_menu_id );
    1224 
    1225     if ( is_wp_error( $delete_nav_menu ) )
    1226         return $delete_nav_menu;
    1227 
    1228     // Remove this menu from any locations.
    1229     $locations = get_theme_mod( 'nav_menu_locations' );
    1230     foreach ( (array) $locations as $location => $menu_id ) {
    1231         if ( $menu_id == $nav_menu_id )
    1232             $locations[ $location ] = 0;
    1233     }
    1234     set_theme_mod( 'nav_menu_locations', $locations );
    1235     return true;
    1236 }
    1237 
    1238 /**
    12391209 * Saves nav menu items
    12401210 *
  • trunk/wp-admin/nav-menus.php

    r23844 r23897  
    232232        check_admin_referer( 'delete-nav_menu-' . $nav_menu_selected_id );
    233233        if ( is_nav_menu( $nav_menu_selected_id ) ) {
    234             $deletion = _wp_delete_nav_menu( $nav_menu_selected_id );
     234            $deletion = wp_delete_nav_menu( $nav_menu_selected_id );
    235235        } else {
    236236            // Reset the selected menu
     
    254254                continue;
    255255
    256             $deletion = _wp_delete_nav_menu( $menu_id_to_delete );
     256            $deletion = wp_delete_nav_menu( $menu_id_to_delete );
    257257            if ( is_wp_error( $deletion ) ) {
    258258                $messages[] = '<div id="message" class="error"><p>' . $deletion->get_error_message() . '</p></div>';
  • trunk/wp-includes/nav-menu.php

    r23554 r23897  
    189189
    190190    $result = wp_delete_term( $menu->term_id, 'nav_menu' );
     191
     192    // Remove this menu from any locations.
     193    $locations = get_theme_mod( 'nav_menu_locations' );
     194    foreach ( (array) $locations as $location => $menu_id ) {
     195        if ( $menu_id == $nav_menu_id )
     196            $locations[ $location ] = 0;
     197    }
     198    set_theme_mod( 'nav_menu_locations', $locations );
    191199
    192200    if ( $result && !is_wp_error($result) )
Note: See TracChangeset for help on using the changeset viewer.