是否在外观>菜单中默认自动显示‘分类’元框?

时间:2013-01-05 作者:Gilles Vauvarin

是否有方法(使用代码)在外观>菜单中自动显示“分类法”元框?

这样,用户就不必单击“屏幕选项”选项卡>“在屏幕上显示”>“分类法”复选框

1 个回复
SO网友:Gilles Vauvarin

谢谢@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 );
}
}

结束

相关推荐

我如何才能让Taxonomy Images与‘orderby’参数一起工作?

我正在使用分类法图像插件,并试图对分类法进行排序,但分类法图像效果不佳。这项工作:$terms = get_terms( \'work_cat\', $args ); 但事实并非如此:$terms = apply_filters( \'taxonomy-images-get-terms\', \'\', $args ); 有什么想法吗?以下是完整的查询:<?php $args = array( \'taxonomy\' =>