Key takeaways
- PHP warnings and notices shown on a live site look unprofessional and can expose server paths to attackers.
- Turn display off in
wp-config.phpwithWP_DEBUGset to false, or keep logging on with display off. - Hiding errors isn’t fixing them — check the log and update the plugin or theme causing them.
Messages like “Warning: Undefined array key… in /home/user/public_html/wp-content/plugins/…” appearing at the top of your pages usually mean debug display was left on, or the host shows errors by default. Here’s how to hide them properly — and still see them when you need to.
Option 1: the standard wp-config.php settings#
Open wp-config.php (in your site’s root folder) and find any existing WP_DEBUG line. Replace it with:
define( 'WP_DEBUG', false );
Make sure this is above the line /* That's all, stop editing! */.
Option 2: log errors without showing them (recommended)#
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
Visitors see nothing, while errors are written to wp-content/debug.log. You can also set a custom log path outside the web root for security:
define( 'WP_DEBUG_LOG', '/home/user/logs/wp-errors.log' );
Option 3: hosting control panel#
Many hosts (cPanel’s “MultiPHP INI Editor”, hPanel’s PHP configuration) let you set display_errors = Off. If errors still show after changing wp-config.php, the host setting or a plugin may be overriding it.
Errors still showing?#
- Search
wp-config.phpfor a secondWP_DEBUGdefinition further down. - Check for
ini_set( 'display_errors', 1 )in plugins orfunctions.php. - Check
.htaccessor.user.iniforphp_flag display_errors on. - Clear page and CDN caches — cached pages may still contain old error text.
Need a hand with this?
Get a quick, honest review of your website’s SEO.
Understanding error types#
| Type | Meaning | Action |
|---|---|---|
| Notice / Deprecated | Code uses outdated or sloppy patterns | Update the plugin/theme; usually harmless |
| Warning | Something unexpected, but code continues | Investigate; may cause wrong output |
| Fatal error | Code stopped — page breaks | Fix immediately — see white screen of death |
Fix the cause#
- Open
debug.logand note which plugin or theme file is mentioned. - Update that plugin/theme — many warnings come from PHP 8 changes fixed in newer versions.
- If it’s abandoned, look for an alternative.
- Delete old log files periodically; they can grow large.
PHP errors FAQ#
Do PHP warnings affect SEO?#
Visible warnings can break layouts, appear in search snippets and look unprofessional. Fatal errors can make pages unavailable. Hide display and fix the cause.
Is it safe to leave WP_DEBUG_LOG on?#
Yes, if display is off and the log isn’t publicly accessible. Store it outside the web root or block access to it.
Why did errors appear after a PHP upgrade?#
PHP 8 is stricter. Outdated plugins trigger warnings or deprecations; update them.