mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-07 08:01:54 +01:00
fix custom menu hierarchy support in admin, See #11817
git-svn-id: http://svn.automattic.com/wordpress/trunk@13348 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c68fb87dee
commit
f9edbbfc00
@ -106,6 +106,7 @@ if ( isset($_POST['reset_wp_menu']) ) {
|
|||||||
}
|
}
|
||||||
} elseif ( $postCounter > 0 && $menu_selected_id > 0 ) {
|
} 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') );
|
$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
|
// Loop through all POST variables
|
||||||
for ( $k = 1; $k <= $postCounter; $k++ ) {
|
for ( $k = 1; $k <= $postCounter; $k++ ) {
|
||||||
@ -130,8 +131,8 @@ if ( isset($_POST['reset_wp_menu']) ) {
|
|||||||
$post['post_content_filtered'] = '_blank';
|
$post['post_content_filtered'] = '_blank';
|
||||||
else
|
else
|
||||||
$post['post_content_filtered'] = '';
|
$post['post_content_filtered'] = '';
|
||||||
if ( $parent_id > 0 && isset( $_POST[ 'dbid' . $parent_id ] ) )
|
if ( $parent_id > 0 && isset( $parent_menu_ids[ $parent_id ] ) )
|
||||||
$post[ 'post_parent' ] = (int) $_POST[ 'dbid' . $parent_id ];
|
$post[ 'post_parent' ] = $parent_menu_ids[ $parent_id ];
|
||||||
|
|
||||||
// New menu item
|
// New menu item
|
||||||
if ( $db_id == 0 ) {
|
if ( $db_id == 0 ) {
|
||||||
@ -141,6 +142,8 @@ if ( isset($_POST['reset_wp_menu']) ) {
|
|||||||
wp_update_post( $post );
|
wp_update_post( $post );
|
||||||
unset( $menu_items[$db_id] );
|
unset( $menu_items[$db_id] );
|
||||||
}
|
}
|
||||||
|
$parent_menu_ids[ $k ] = $db_id;
|
||||||
|
|
||||||
update_post_meta($db_id, 'menu_type', $linktype);
|
update_post_meta($db_id, 'menu_type', $linktype);
|
||||||
update_post_meta($db_id, 'object_id', $object_id);
|
update_post_meta($db_id, 'object_id', $object_id);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user