Make sure PHP warnings and errors are never printed on your live site, where they can reveal file paths and plugin details.
// Replace any existing WP_DEBUG lines in wp-config.php with these.
define( 'WP_DEBUG', false );
define( 'WP_DEBUG_DISPLAY', false );
// Many hosts show PHP errors by default, even with WP_DEBUG off.
ini_set( 'display_errors', '0' );
A PHP warning printed on your live site looks broken, and it can reveal your server’s folder structure, plugin names and versions. With WP_DEBUG off, WordPress reduces which errors are reported, but it doesn’t stop the server displaying them. This snippet does both.
WP_DEBUG set to false turns off WordPress’s debug mode, and WP_DEBUG_DISPLAY set to false tells WordPress not to print errors. ini_set( 'display_errors', '0' ) tells PHP itself not to print any errors, which covers hosts that switch display on by default.
Errors are still written to your server’s error log, where only you can see them.
WP_DEBUG line in wp-config.php rather than adding a second one; defining a constant twice causes a warning of its own.WP_DEBUG to true and add define( 'WP_DEBUG_LOG', true ); to write errors to wp-content/debug.log, while keeping display off.View your site in a private window after triggering a known notice (for example, from a plugin you’re testing). No PHP message should appear on the page.