Best practice to disable error reporting in WordPress

I have seen a few posts that developers looking for a way to disable PHP notices or to disable php warnings showing up in WordPress.

Some tutorials suggests putting the following code at the top of wp-config.php file disables PHP errors:


But unfortunately, this does not work, however, because when that file calls wp-settings.php at the bottom, the error reporting will be overridden by WordPress’s own settings.

In order for the above line to work, it must come after the call to wp-settings.php or at the end of wp-config.php file, like below…

/** Sets up WordPress vars and included files. */
    require_once(ABSPATH . 'wp-settings.php');


If you want to enable WP_DEBUG, you will have to comment out this line otherwise it won’t display any debugging errors.

One thought on “Best practice to disable error reporting in WordPress

  1. phil salt

    Thank you Dipak. Been struggling to find a way to tweak error_reporting. This answered it for me.

    Be well,

Leave a Reply

Your email address will not be published. Required fields are marked *

Please note: These tutorials are meant to be helpful, but please note that I can not and will not be able to help with any implementations or modifications.

tl;dr If you do not understand it, hire me to do it.