Where is the User’s Admin Bar Preference stored? I want it to default to off for new users

The question:

In the profile.php admin page there is a checkbox for the Toolbar: Show Toolbar when viewing site.

I can’t seem to find where this option is stored in the database. I would have thought it would be in the wp_usermeta table … but I don’t see it.

My goal is to set the default value of this to “off” for new users. Then, of course, they would have the option to turn it on if they wanted.

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

You can update the usermeta upon user registration.

Try adding this to functions.php and then adding a new user:

add_action('user_register', 'update_usermeta_bar', 10, 1);

function update_usermeta_bar($user_id)

    update_user_meta($user_id, 'show_admin_bar_front', "false");

Method 2

In the usermeta table, there is a key called “show_admin_bar_front” Try this query:

FROM wp_usermeta
WHERE meta_key LIKE 'show_admin_bar_front'

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment