October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
PHP

How to Turn Off PHP Errors in WordPress (Safely)

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To stop PHP errors appearing on a live WordPress site, edit wp-config.php and set the debug constants to the boolean false, while explicitly disabling PHP display_errors. Put the definitions above the “That’s all, stop editing!” line. If you need to investigate a fault, keep errors hidden and enable logging temporarily instead of displaying them to visitors.

Disable PHP errors on public pages

Use your host’s file manager, SFTP, or another supported file-access method to open the active site’s wp-config.php. Add or edit these lines before WordPress loads (normally above the “That’s all, stop editing!” line):

@ini_set( 'log_errors', 'On' );
@ini_set( 'display_errors', 'Off' );
define( 'WP_DEBUG', false );
define( 'WP_DEBUG_LOG', false );
define( 'WP_DEBUG_DISPLAY', false );

This production pattern asks PHP not to print errors and leaves PHP’s logging facility available, while WordPress debug mode, its display output, and its debug log are disabled. Do not add a second definition if the file already contains one; edit the existing line instead.

Use real PHP booleans

Write false without quotation marks. The value 'false' is a non-empty PHP string and is therefore truthy, so it does not turn debugging off. The same rule applies to true.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why both WordPress and PHP settings matter

WP_DEBUG_DISPLAY controls WordPress debug messages when WP_DEBUG is active. PHP’s own display_errors directive can still affect output, so explicitly setting it to Off (or 0) is important. A hosting policy may override either setting.

Hide errors while you troubleshoot

If an error needs investigation, record it privately without putting the details in page HTML. Temporarily use:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

WordPress then records debug output in wp-content/debug.log by default while keeping it out of the response sent to visitors. WP_DEBUG_LOG can also be a valid custom file path if your setup supports one.

  1. Back up wp-config.php before changing it.
  2. Apply the diagnostic settings and reproduce the problem privately.
  3. Read the log through a protected administrative or server-access method; never publish its contents.
  4. Fix the plugin, theme, configuration, or code identified by the log.
  5. Return to the production settings, then remove the temporary log or move it outside the public web root.

Debug mode is intended for development and staging. Do not turn visible errors on for a public site merely to obtain a diagnosis.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Protect the debug log

A log can contain file paths, configuration details, database-related information, usernames, request data, or other sensitive values. The default wp-content/debug.log location may be web-accessible depending on server rules. Restrict access to it, store logs outside the public document root when possible, and delete temporary logs after troubleshooting.

When wp-config.php does not change the output

The PHP handler or server may control display_errors and refuse or override an in-file ini_set(). First confirm that you edited the active site’s configuration and that there are no duplicate constant definitions. Then identify whether the site uses Apache’s PHP module, FastCGI/PHP-FPM, or a host-managed setup.

Apache PHP module

Where the host permits PHP directives in .htaccess, an Apache-module configuration can use:

<IfModule mod_php8.c>
    php_flag display_errors off
</IfModule>

The module name and whether this directive is permitted vary by server. Do not add this example to a FastCGI/PHP-FPM site unless your host specifically supports it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

FastCGI or PHP-FPM

Some hosts allow a .user.ini file containing:

display_errors = 0

PHP-FPM implementations differ in where user-level settings are accepted and how quickly they are reloaded. Follow the host’s documented method rather than assuming this file will be read.

Managed hosting controls

Many providers expose PHP error display in a hosting control panel or lock the directive at the server level. Check the panel’s PHP or error-handling settings. If the site is down, the WordPress log is unavailable, or the setting remains unchanged, ask the provider where its server-level error log is stored and request that public error display be disabled.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common mistakes to avoid

  • Do not use define( 'WP_DEBUG', 'false' );; quoted values are strings, not booleans.
  • Do not define WP_DEBUG, WP_DEBUG_DISPLAY, or WP_DEBUG_LOG twice; the first definition can remain in force and produce confusing results.
  • Do not assume WP_DEBUG_DISPLAY alone overrides PHP’s display_errors directive.
  • Do not treat WP_DEBUG_DISPLAY or WP_DEBUG_LOG as independent switches: they operate in conjunction with WP_DEBUG.
  • Do not leave debugging or an unprotected debug.log enabled after the investigation.

Choose the setting for your situation

Goal WP_DEBUG WP_DEBUG_DISPLAY WP_DEBUG_LOG PHP display_errors
Normal production operation false false false Off or 0
Temporary diagnosis without exposing errors true false true Off or 0
Visible errors on a public site Not recommended Not recommended Not recommended Not recommended

The key distinction is visibility versus recording: keep visibility off for visitors, and enable recording only for the limited period needed to diagnose a problem.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.