谢谢@guiniveretoo,完美:)
最后,我是这样做的(此代码用于菜单页面屏幕选项):
/* Just use to find your screen_id */
add_filter(\'current_screen\', \'the_current_screen\' );
function the_current_screen($screen) {
if ( defined( \'DOING_AJAX\' ) && DOING_AJAX ) return $screen;
print_r($screen);
return $screen;
}
/* Just use to display the options id */
add_filter(\'current_screen\', \'the_screen_options\' );
function the_screen_options() {
global $wp_meta_boxes;
$hidden = get_hidden_meta_boxes( \'nav-menus\' );
var_dump( $hidden );
}
/* Show the all options by default in the menu page */
add_action(\'admin_init\', \'set_user_metaboxes\');
function set_user_metaboxes( $user_id = NULL ) {
// These are the metakeys we will need to update in the menu page
$meta_key[\'hidden\'] = \'metaboxhidden_nav-menus\';
// So this can be used without hooking into user_register
if ( !$user_id )
$user_id = get_current_user_id();
// Set the default hiddens if it has not been set yet
if ( get_user_meta( $user_id, $meta_key[\'hidden\'], true) ) {
$meta_value = array(\'\');
update_user_meta( $user_id, $meta_key[\'hidden\'], $meta_value );
}
}