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 badges3 Answers
Reset to default 3This 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' );