Permalink
Browse files

Remove _wp_delete_nav_menu(). wp_delete_nav_menu() should instead rem…

…ove the menu from theme locations, which was the only difference between the functions. see #23119.

git-svn-id: http://core.svn.wordpress.org/trunk@23897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
nacin committed Apr 4, 2013
1 parent 8fdaa65 commit 10d898ecbb8daa10ea9e583487700317359aff25
Showing with 10 additions and 32 deletions.
  1. +0 −30 wp-admin/includes/nav-menu.php
  2. +2 −2 wp-admin/nav-menus.php
  3. +8 −0 wp-includes/nav-menu.php
@@ -1205,36 +1205,6 @@ function _wp_delete_orphaned_draft_menu_items() {
}
add_action('admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items');
-/**
- * Delete nav menus from the nav menu management screen
- *
- * @since 3.6.0
- * @access private
- *
- * @param int|string $nav_menu_id The menu to delete (id, slug, or name)
- * @return false if Error, otherwise true
- */
-function _wp_delete_nav_menu( $nav_menu_id ) {
-
- if ( ! is_nav_menu( $nav_menu_id ) )
- return;
-
- $deleted_nav_menu = wp_get_nav_menu_object( $nav_menu_id );
- $delete_nav_menu = wp_delete_nav_menu( $nav_menu_id );
-
- if ( is_wp_error( $delete_nav_menu ) )
- return $delete_nav_menu;
-
- // Remove this menu from any locations.
- $locations = get_theme_mod( 'nav_menu_locations' );
- foreach ( (array) $locations as $location => $menu_id ) {
- if ( $menu_id == $nav_menu_id )
- $locations[ $location ] = 0;
- }
- set_theme_mod( 'nav_menu_locations', $locations );
- return true;
-}
-
/**
* Saves nav menu items
*
View
@@ -231,7 +231,7 @@
case 'delete':
check_admin_referer( 'delete-nav_menu-' . $nav_menu_selected_id );
if ( is_nav_menu( $nav_menu_selected_id ) ) {
- $deletion = _wp_delete_nav_menu( $nav_menu_selected_id );
+ $deletion = wp_delete_nav_menu( $nav_menu_selected_id );
} else {
// Reset the selected menu
$nav_menu_selected_id = 0;
@@ -253,7 +253,7 @@
if ( ! is_nav_menu( $menu_id_to_delete ) )
continue;
- $deletion = _wp_delete_nav_menu( $menu_id_to_delete );
+ $deletion = wp_delete_nav_menu( $menu_id_to_delete );
if ( is_wp_error( $deletion ) ) {
$messages[] = '<div id="message" class="error"><p>' . $deletion->get_error_message() . '</p></div>';
$deletion_error = true;
View
@@ -189,6 +189,14 @@ function wp_delete_nav_menu( $menu ) {
$result = wp_delete_term( $menu->term_id, 'nav_menu' );
+ // Remove this menu from any locations.
+ $locations = get_theme_mod( 'nav_menu_locations' );
+ foreach ( (array) $locations as $location => $menu_id ) {
+ if ( $menu_id == $nav_menu_id )
+ $locations[ $location ] = 0;
+ }
+ set_theme_mod( 'nav_menu_locations', $locations );
+
if ( $result && !is_wp_error($result) )
do_action( 'wp_delete_nav_menu', $menu->term_id );

0 comments on commit 10d898e

Please sign in to comment.