While I quite like the admin bar I actually want it to be OFF by default instead of ON ( I don’t want to disable it altogether because I want users to be able to turn it on if they want – but but I don’t want to have to manually turn it off for every user ) Is there a way to implement this.

3 s
3

add_action("user_register", "set_user_admin_bar_false_by_default", 10, 1);
function set_user_admin_bar_false_by_default($user_id) {
    update_user_meta( $user_id, 'show_admin_bar_front', 'false' );
    update_user_meta( $user_id, 'show_admin_bar_admin', 'false' );
}

Place in theme functions file or you can make into a plugin.

Once user registers it will go and set the users admin bar prefs to false. The user can then, once logged in, set this to true.

Leave a Reply

Your email address will not be published. Required fields are marked *