How to fix WordPress Header Overlapping in admin

How to fix WordPress Header Overlapping in admin

Share

Every Developer nightmare is your application or website not working the way they should the same rules applies to WordPress Developer. As beginners developing your shiny WordPress theme for your blog, personal website or practice website you might have run into a famous bug of WordPress Header Overlapping in Admin. Yes, it’s quite common and below is how you can fix it with the breeze.

function name_your_function($classes){
    if(is_user_logged_in()){
        $classes[] = 'body-logged-in';
    }
    return $classes;
}
add_filter('body_class', 'name_your_function');

Add the above code to your functions.php, the code checks if you are logged in and if you are logged in it will add the class name body-logged-in to your body class in your theme and all you need to do next is style it in your style.css or you can just paste CSS code to your additional CSS under customizer

body.body-logged-in { top: 30px !important; }

Let me know if that works in the comment section.