0

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.

2 Answers 2

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");
}
3
  • That's so strange -- I feel like this should work but it is still being set to true after registration ... I wonder if WP is setting this user_meta field after the user_register hook is called and overwriting what we put there. Because my other update_user_meta calls are working in the same place.
    – thornomad
    Feb 26, 2014 at 18:57
  • I got it: false had to be in quotes ... otherwise I don't think it's storing the actual value 'false': update_user_meta($user_id, 'show_admin_bar_front', 'false');
    – thornomad
    Feb 26, 2014 at 19:04
  • I believe any value other than "true" should work. I will update my answer.
    – gdaniel
    Feb 26, 2014 at 19:16
1

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

SELECT * FROM wp_usermeta WHERE meta_key LIKE 'show_admin_bar_front'

1
  • There it is -- I don't know why I didn't see that the first time I looked. Need glasses. Thanks.
    – thornomad
    Feb 26, 2014 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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