How do I remove the ‘Show Toolbar’ option?

Here’s one way to hide it with CSS:

add_action( 'personal_options', function( $profileuser )
{
    ?><style>.show-admin-bar{ display: none;}</style><?php
} );

or rather place it within the <head>...</head> with:

add_action( 'admin_print_styles-user-edit.php', 'wpse_hide_admin_bar_settings' );
add_action( 'admin_print_styles-profile.php',   'wpse_hide_admin_bar_settings' );

function wpse_hide_admin_bar_settings()
{
    ?><style>.show-admin-bar{ display: none;}</style><?php
} 

You could perhaps add your own wpse_hide_admin_bar_settings filter if you need more control:

function wpse_hide_admin_bar_settings()
{
    if( (bool) apply_filters( 'wpse_hide_admin_bar_settings', false ) )
        echo '<style>.show-admin-bar{ display: none;}</style>';
} 

and then turn it off/on with:

add_filter( 'wpse_hide_admin_bar_settings', '__return_false' ); // show it
add_filter( 'wpse_hide_admin_bar_settings', '__return_true' );  // hide it

Leave a Comment