Fix initial hidden meta boxes for nav menus. see #13134
git-svn-id: http://svn.automattic.com/wordpress/trunk@14304 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5f501c920c
commit
8420f41a24
|
@ -321,28 +321,26 @@ function wp_nav_menu_setup() {
|
|||
function wp_initial_nav_menu_meta_boxes() {
|
||||
global $wp_meta_boxes;
|
||||
|
||||
if ( !get_user_option( 'meta-box-hidden_nav-menus' ) && is_array($wp_meta_boxes) ) {
|
||||
if ( get_user_option( 'metaboxhidden_nav-menus' ) || ! is_array($wp_meta_boxes) )
|
||||
return;
|
||||
|
||||
$initial_meta_boxes = array( 'manage-menu', 'create-menu', 'add-custom-links', 'add-page', 'add-category' );
|
||||
$hidden_meta_boxes = array();
|
||||
|
||||
$initial_meta_boxes = array( 'manage-menu', 'create-menu', 'add-custom-links', 'add-page', 'add-category' );
|
||||
$hidden_meta_boxes = array();
|
||||
|
||||
foreach ( array_keys($wp_meta_boxes['nav-menus']) as $context ) {
|
||||
foreach ( array_keys($wp_meta_boxes['nav-menus'][$context]) as $priority ) {
|
||||
foreach ( $wp_meta_boxes['nav-menus'][$context][$priority] as $box ) {
|
||||
if ( in_array( $box['id'], $initial_meta_boxes ) ) {
|
||||
unset( $box['id'] );
|
||||
} else {
|
||||
$hidden_meta_boxes[] = $box['id'];
|
||||
}
|
||||
foreach ( array_keys($wp_meta_boxes['nav-menus']) as $context ) {
|
||||
foreach ( array_keys($wp_meta_boxes['nav-menus'][$context]) as $priority ) {
|
||||
foreach ( $wp_meta_boxes['nav-menus'][$context][$priority] as $box ) {
|
||||
if ( in_array( $box['id'], $initial_meta_boxes ) ) {
|
||||
unset( $box['id'] );
|
||||
} else {
|
||||
$hidden_meta_boxes[] = $box['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
$user = wp_get_current_user();
|
||||
update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
|
||||
|
||||
// returns all the hidden metaboxes to the js function: wpNavMenu.initial_meta_boxes()
|
||||
return join( ',', $hidden_meta_boxes );
|
||||
}
|
||||
$user = wp_get_current_user();
|
||||
update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
|
||||
$option = get_user_option( 'metaboxhidden_nav-menus', $user->ID);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -319,6 +319,8 @@ if ( current_theme_supports('nav-menus') ) {
|
|||
$messages[] = '<div id="message" class="error"><p>' . __('The current theme does not support menus.') . '</p></div>';
|
||||
}
|
||||
|
||||
wp_initial_nav_menu_meta_boxes();
|
||||
|
||||
// Get the admin header
|
||||
require_once( 'admin-header.php' );
|
||||
?>
|
||||
|
@ -403,7 +405,6 @@ require_once( 'admin-header.php' );
|
|||
<?php wp_nonce_field( 'update-nav_menu', 'update-nav-menu-nonce' ); ?>
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="menu" id="menu" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />
|
||||
<input type="hidden" id="hidden-metaboxes" value="<?php echo wp_initial_nav_menu_meta_boxes(); ?>" />
|
||||
</div><!--END #nav-menu-header-->
|
||||
<div id="post-body">
|
||||
<div id="post-body-content">
|
||||
|
|
Loading…
Reference in New Issue