最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

WordPress Left Hand Side Admin Menu Always Collapsed

programmeradmin3浏览0评论

Can anyone please help me with my problem regarding my WordPress left hand side admin menu. I want it collapsed at all times, how do I do that?

Well, I'm creating a WP Multisite so I want that menu bar to be always collapsed at all times.

Any help would be appreciated. Looking for code or if plugin exists, should be fine, too. Thanks.

Can anyone please help me with my problem regarding my WordPress left hand side admin menu. I want it collapsed at all times, how do I do that?

Well, I'm creating a WP Multisite so I want that menu bar to be always collapsed at all times.

Any help would be appreciated. Looking for code or if plugin exists, should be fine, too. Thanks.

Share Improve this question asked Sep 27, 2014 at 23:40 JianJian 111 silver badge4 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 3

This will properly override the user settings to keep the menu collapsed for all users:

/**
 * Reset user setting to always collapse the admin menu.
 *
 * @see set_user_setting()
 */
function wpdocs_always_collapse_menu() {
    if ( 'f' != get_user_setting( 'mfold' ) ) {
        set_user_setting( 'mfold', 'f' );
    }
}
add_action( 'admin_head', 'wpdocs_always_collapse_menu' );

You can try something like this.

function make_menu_unfolded() {
    print '<script>jQuery(document).ready(function(){jQuery("body").addClass("folded")})</script>';
}
add_filter( 'admin_head', 'make_menu_unfolded' );

This is make left menu fold always.

If you want the admin menu to always be uncollapsed use this in your functions.php file.

function wpdocs_always_unfold_menu() {
    if ( 'f' != get_user_setting( 'unfold' ) ) {
        set_user_setting( 'unfold', 'f' );
    }
}
add_action( 'admin_head', 'wpdocs_always_unfold_menu' );
发布评论

评论列表(0)

  1. 暂无评论