Support » Developing with WordPress » PHP Errors and Warnings

  • Resolved regnalf

    (@regnalf)


    Hi,

    i’ve activated the debug true flag in the config file.
    Is it possible to suppress the warnings and show only the errors?

    Thanks in advance

    Regnalf

Viewing 2 replies - 1 through 2 (of 2 total)
  • There’s no configuration option, as with WP_DEBUG set, WordPress sets the error reporting level to E_ALL & ~E_DEPRECATED & ~E_STRICT. This means all warnings and errors except strict errors and PHP deprecated functions (not WordPress ones) will be reported.

    But note that you can disable the on-screen display, and log to a file instead. Please see https://wordpress.org/support/article/debugging-in-wordpress/

    And, of course, you have PHP’s native error_log() function, the verbosity of which can be tweaked to your heart’s desire: https://www.php.net/manual/en/errorfunc.constants.php

    If you really want to control the WP_DEBUG out level, you’d probably have to write a little mu-plugin.

    UPDATE:

    The WordPress debugging support article linked above has this on logging to file:

    Note that this allows you to write to log file using PHP’s built in error_log() function, which can be useful for instance when debugging Ajax events.

    So logging to file uses PHP’s built-in error_log() function — but I’m not sure if it’ll respect your server’s configured PHP error reporting level, or it’ll still use E_ALL & ~E_DEPRECATED & ~E_STRICT. (Alexa, add that to my weekend TO DOs 😀 )

    Thread Starter regnalf

    (@regnalf)

    Thanks a lot!!!

    This helps to keep the page usable, because there are many warnings!

    About Alexa, would be great to say her “Alex, please debug and fix my WordPress site”. Maybe in 10 Years …

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.