Collapse the Admin Menu by Default
Starts everyone with the narrow, icon-only admin menu for more working space. Users who expand it keep their choice.
Opens WPIDE on
Code
add_filter( 'admin_body_class', function ( $classes ) {
// "mfold" is the saved collapse setting; it is empty until the user toggles the menu.
if ( '' === (string) get_user_setting( 'mfold', '' ) && false === strpos( $classes, 'folded' ) ) {
$classes .= ' folded';
}
return $classes;
} );
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.