• Resolved gilgimech

    (@gilgimech)


    One issue I’ve found with the new admin bar, is that since it has a fixed position. It covers up the first few lines of php errors. Has anyone found a way to deal with this other than disabling the admin bar all together?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    The admin bar is now called the “Toolbar”, combining the Admin Bar and admin header. You cannot turn off the Toolbar on the backend anymore, however you CAN turn it off on the front end in your profile.

    To turn it off globally (for all users) on the front end you can put this in your theme’s functions.php:

    if(!is_admin()){
    add_filter('show_admin_bar', '__return_false');
    }

    or

    show_admin_bar( false );

    I’ve also noticed it covers up the first lines of notices and errors.

    Thread Starter gilgimech

    (@gilgimech)

    You can turn it off in the backend.

    this worked for me.

    if (!function_exists('disableAdminBar')) {
    
    	function disableAdminBar() { // begin disableAdminBar function
    
    		remove_action( 'admin_footer', 'wp_admin_bar_render', 1000 );
    
    		function remove_admin_bar_style_backend() {
    			echo '<style>body.admin-bar #wpcontent, body.admin-bar #adminmenu { padding-top: 0px !important; }</style>';
    		}
    
    		add_filter('admin_head','remove_admin_bar_style_backend');
    
    	}  
    
    }
    
    add_action('init','disableAdminBar');

    I know it’s not the best way of doing it, but when your developing themes and plugins you need to be able to see those errors. So the toolbar has to go (for developing anyway). I don’t recommend doing something like that for a live site.

    I don’t think they thought about that when the core team designed this new toolbar.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Can yes, should no.

    And yes, the core team thought about that. They do this instead: https://nacin.com/tag/wp_debug/

    Thread Starter gilgimech

    (@gilgimech)

    And yes, the core team thought about that. They do this instead: https://nacin.com/tag/wp_debug/

    Which part are you referring to? I didn’t see anything that would solve the toolbar covering the errors issue.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    They use other methods to track errors (like logging them etc).

    Thread Starter gilgimech

    (@gilgimech)

    This seems to work.

    if ((error_reporting() && is_admin())) {
        echo '<style>body{ padding-top: 28px !important; }</style>';
        return;
    }

    If there is an error it adds padding to the body pushing everything down except the tool bar.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘3.3 admin bar Covers Errors’ is closed to new replies.