After the recent update of WordPress, version 5.5.1.
Whenever I enabled the debug mode, there is a 2em gap between WordPress admin menu and the bar.
.php-error #adminmenuback, .php-error #adminmenuwrap {
margin-top: 2em;
}
Found out that this is showing because there is a hidden error somewhere on the website?
How I could show that error?
After the recent update of WordPress, version 5.5.1.
Whenever I enabled the debug mode, there is a 2em gap between WordPress admin menu and the bar.
.php-error #adminmenuback, .php-error #adminmenuwrap {
margin-top: 2em;
}
Found out that this is showing because there is a hidden error somewhere on the website?
How I could show that error?
Share Improve this question edited Oct 14, 2020 at 7:23 bueltge 17.1k7 gold badges62 silver badges97 bronze badges asked Oct 14, 2020 at 1:11 MarlonMarlon 318 bronze badges2 Answers
Reset to default 2One way to do that is to enable WP_DEBUG_LOG in wp-config.php
. The file will look like this:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true ); //You may also set the log file path instead of just true
Defining WP_DEBUG_LOG as true will save logs under wp-content/debug.log
and you'll find the PHP errors there.
---Fix---
That CSS gap will only show when there is a "Hidden" error.
If these conditions are true,
if ( $error && WP_DEBUG && WP_DEBUG_DISPLAY && ini_get( 'display_errors' )
the gap will show, it means that $error variable is not empty, we should show the value in a log file.
To solve this issue, we need to show that hidden error by adding this code..
wp-admin/admin-header.php on line 201
$error = error_get_last();
error_log('===================This is the hidden error==================');
error_log(print_r($error,true));
error_log('=================Error Setting display======================');
error_log('WP_DEBUG');
error_log(print_r(WP_DEBUG ,true));
error_log('WP_DEBUG_DISPLAY');
error_log(print_r(WP_DEBUG_DISPLAY,true));
error_log('display_errors ini setting');
error_log(print_r(ini_get( 'display_errors' ),true));
After checking the debug.log, we can now see and fix the error.
This is related to this issue How to fix the admin menu margin-top bug in WordPress 5.5? and my answer also resolved it...