Suppress PHP DEPRECATED and WARNING notices in WordPress (without touching wp-config.php)

If you have ever opened your WordPress error logs only to find them flooded with thousands of E_DEPRECATED and E_WARNING notices, most of them coming from plugins you don’t control, this post is for you.

What you need is a must-use plugin that installs a custom error handler. It suppresses those noisy notices while allowing everything else to log normally. Fatal errors, parse errors, and any unsuppressed issues will still be recorded as expected.

And because it lives in the mu-plugins directory, it loads automatically before any standard plugin runs. This is the only way I know that 100% works.

The code

<?php
/**
 * Must-Use Plugin: Suppress PHP Deprecated and Warning Notices
 * Description: Installed as mu-plugin to load before all other plugins.
 * Version: 1.0
 */
set_error_handler( 'muplugin_custom_error_handler' );
function muplugin_custom_error_handler( $errno, $errstr, $errfile, $errline ) {
    if ( in_array( $errno, [ E_DEPRECATED, E_USER_DEPRECATED, E_WARNING, E_USER_WARNING ], true ) ) {
        return true;
    }
    return false;
}

?>

How to install it

1. Create the mu-plugins folder if it doesn’t exist

Must-use plugins live at wp-content/mu-plugins/. If that folder isn’t already there, create it via FTP/SFTP or your host’s file manager.

2. Save the code as a .php file

Name it something descriptive, e.g. suppress-notices.php. The filename doesn’t matter to WordPress, but you’ll thank yourself later when scanning the folder.

3. Upload it to wp-content/mu-plugins/

That’s it. There’s nothing to activate, WordPress loads every file in that folder automatically on every request, before regular plugins.

4. Verify it’s loaded

Go to WP Admin → Plugins → Must-Use and you should see your new plugin listed there.

Important! A word of caution

This is a housekeeping tool, not a substitute for fixing the underlying issues. Deprecated notices in particular are PHP‘s way of telling you that code you are running will break in a future version. Silencing them in production is reasonable; ignoring them forever is not.

A good workflow: suppress the noise in production so your logs stay useful, but periodically run your site in a staging environment with full error reporting enabled to catch anything that needs actual attention.

First dropped: | Last modified: June 02, 2026

Leave a Comment