0

Is there any way to style the message delivered by wp_debug?

Whenever I set WP_Debug to true, it pushes all my content down the page. While I admit it's easy to just set it back to false after using it, it can be somewhat tedious switching it on and off when it's needed.

Is there a way to style the message it creates, so that I'm then able to prevent it from moving content around?

I imagine I'd do something like this:

#error
{
position: fixed;
top: 0px;
width: 100%;
z-index: 2;
}

etc.

2 Answers 2

2

You could add following code (if not done already) in wp-config.php (please make a backup first of this file):

define('WP_DEBUG', true);
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

This way debug is activated but the results (if have errors/notices) will not be shown but will be saved in a logfile which you can find then in wp-content folder. THe file which 'collects' all is debug.log.

See the Codex for further explanations

Side note: (I know I should not do it but...) you also can look for a plugin (as addon to make it yourself easier during your work) named debug-bar and or others.

1

Reference : Debugging in wordpress

If you are looking for style these debug message then you should have these class for style. Set style as you wish by class that you need.

And if you don't want show these wording but continue debug then you need to use WP_DEBUG_LOG and WP_DEBUG_DISPLAY. Below point that you need to perform to achieve debug log file.

  1. Enable WP_DEBUG mode
  2. Enable Debug logging to the /wp-content/debug.log file
  3. Disable display of errors and warnings

WP_DEBUG_LOG is a companion to WP_DEBUG that causes all errors to also be saved to a debug.log log file inside the /wp-content/ directory. This is useful if you want to review all notices later or need to view notices generated off-screen.

define('WP_DEBUG_LOG', true);

WP_DEBUG_LOG to do anything, WP_DEBUG must be enabled (true). Remember you can turn off WP_DEBUG_DISPLAY independently.

WP_DEBUG_DISPLAY is another companion to WP_DEBUG that controls whether debug messages are shown inside the HTML of pages or not.

define('WP_DEBUG_DISPLAY', false);

WP_DEBUG_DISPLAY to do anything, WP_DEBUG must be enabled (true). Remember you can control WP_DEBUG_LOG independently.

Finally your wp-config.php file have below lines for above solution.

define('WP_DEBUG', true);//Enable WP_DEBUG mode
define( 'WP_DEBUG_LOG', true );//Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_DISPLAY', false );//Disable display of errors and warnings

Let me know if you have any query regarding this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.