fix custom menu hierarchy support in admin, See #11817

git-svn-id: https://develop.svn.wordpress.org/trunk@13348 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ron Rennick 2010-02-23 23:13:54 +00:00
parent d37de180e1
commit 79d6e6993d
1 changed files with 5 additions and 2 deletions

View File

@ -106,6 +106,7 @@ if ( isset($_POST['reset_wp_menu']) ) {
}
} elseif ( $postCounter > 0 && $menu_selected_id > 0 ) {
$menu_items = wp_get_nav_menu_items( $menu_selected_id, array('orderby' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID') );
$parent_menu_ids = array();
// Loop through all POST variables
for ( $k = 1; $k <= $postCounter; $k++ ) {
@ -130,8 +131,8 @@ if ( isset($_POST['reset_wp_menu']) ) {
$post['post_content_filtered'] = '_blank';
else
$post['post_content_filtered'] = '';
if ( $parent_id > 0 && isset( $_POST[ 'dbid' . $parent_id ] ) )
$post[ 'post_parent' ] = (int) $_POST[ 'dbid' . $parent_id ];
if ( $parent_id > 0 && isset( $parent_menu_ids[ $parent_id ] ) )
$post[ 'post_parent' ] = $parent_menu_ids[ $parent_id ];
// New menu item
if ( $db_id == 0 ) {
@ -141,6 +142,8 @@ if ( isset($_POST['reset_wp_menu']) ) {
wp_update_post( $post );
unset( $menu_items[$db_id] );
}
$parent_menu_ids[ $k ] = $db_id;
update_post_meta($db_id, 'menu_type', $linktype);
update_post_meta($db_id, 'object_id', $object_id);
}