mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
add function for deleting individual menus, see #11817
git-svn-id: http://svn.automattic.com/wordpress/trunk@13322 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d91b382e1f
commit
955e9e7527
@ -40,16 +40,22 @@ function wp_custom_navigation_setup($override = false) {
|
||||
$custom_menus = get_terms( 'nav_menu', array( 'hide_empty' => false ) );
|
||||
if ( !empty( $custom_menus ) ) {
|
||||
foreach ( $custom_menus as $menu ) {
|
||||
$menu_objects = get_objects_in_term( $menu->term_id, 'nav_menu' );
|
||||
if ( !empty( $menu_objects ) ) {
|
||||
foreach ( $menu_objects as $item ) {
|
||||
wp_delete_post( $item );
|
||||
}
|
||||
}
|
||||
wp_delete_term( $menu->term_id, 'nav_menu' );
|
||||
wp_custom_navigation_delete_menu( $menu->term_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
function wp_custom_navigation_delete_menu( $menu_term_id ) {
|
||||
$term_id = (int) $menu_term_id;
|
||||
if ( $term_id > 0 ) {
|
||||
$menu_objects = get_objects_in_term( $term_id, 'nav_menu' );
|
||||
if ( !empty( $menu_objects ) ) {
|
||||
foreach ( $menu_objects as $item ) {
|
||||
wp_delete_post( $item );
|
||||
}
|
||||
}
|
||||
wp_delete_term( $term_id, 'nav_menu' );
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
/* Custom Navigation Functions */
|
||||
|
Loading…
Reference in New Issue
Block a user