I would like the backend left menu sidebar be collapsed by default. Yes, I can click the "Collapse menu" button every time but is there a way to have WP open up every time with it collapsed by default?

I tried this solution but it didn't work for me: How to Make admin Sidebar Menu always be Collapse by code

I'm also trying to apply this to a multisite website, not sure if that's why the code from the link didn't work.

Any ideas on how to achieve this?


The following works with a regular site. I have't worked with multisite yet, but I imagine it should be something along the same line:

function change_user_settings() {
    set_user_seting('mfold', 'f');

add_action('admin_init', 'change_user_settings');
  • I received a fatal error from the above code :( – Treb Mar 31 '17 at 6:34
  • What does the error say? – AncientRo Mar 31 '17 at 10:40
  • 'Fatal error: Uncaught Error: Call to undefined function set_user_seting() in /app/public/wp-content/themes/bb-theme-child/functions.php:94 Stack trace: #0 /app/public/wp-includes/class-wp-hook.php(298): change_user_settings('') #1 /app/public/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters(NULL, Array) #2 /app/public/wp-includes/plugin.php(453): WP_Hook->do_action(Array) #3 /app/public/wp-admin/admin.php(154): do_action('admin_init') #4 /app/public/wp-admin/themes.php(10): require_once('/app/public/wp-...') ' – Treb Mar 31 '17 at 11:48
  • My post was tagged as a duplicate. I used the code in that post and it worked. Very similar to what you suggested. – Treb Mar 31 '17 at 11:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.