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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To debug a WordPress failure without exposing details to visitors, enable WP_DEBUG, write diagnostics to a protected log, and keep display errors disabled. Add the constants to wp-config.php before the “That’s all, stop editing!” line, reproduce the failure, then inspect the newest entries in wp-content/debug.log. Use the file, line number, severity, and first plugin or theme function named in the trace to identify the component that needs testing.

The safe WordPress debugging setup

WordPress debugging has three separate controls, but one of them is the master switch:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • WP_DEBUG enables WordPress debugging and raises PHP error reporting to E_ALL.
  • WP_DEBUG_LOG writes PHP errors, warnings, notices, and messages sent through error_log() to a file.
  • WP_DEBUG_DISPLAY controls whether those messages are inserted into generated page HTML.

WP_DEBUG_LOG and WP_DEBUG_DISPLAY do nothing unless WP_DEBUG is true. For a live-facing site, the usual diagnostic combination is debugging enabled, logging enabled, and display disabled. The PHP display_errors setting should also be off.

Setting What it changes Safe default while diagnosing a public site
WP_DEBUG Turns WordPress debugging and broad PHP reporting on or off. true temporarily, then restore false.
WP_DEBUG_LOG Sends diagnostics to the default log or a valid custom file path. true, with protected storage.
WP_DEBUG_DISPLAY Prints diagnostics inside the generated response. false.
display_errors PHP-level control over printing errors in responses. Force off with @ini_set( 'display_errors', 0 );.

Before editing wp-config.php

Back up or use staging

A syntax mistake in wp-config.php can prevent WordPress from loading. Download a copy of the file or create a hosting snapshot first. If the site has a staging environment, perform the first test there and promote only the confirmed fix.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.

Choose an authenticated way to reach the files

Use SSH, SFTP, or the hosting provider’s authenticated file manager. Do not assume that a browser request to a guessed log URL is safe: a debug log can contain file paths, SQL details, request data, and other information that should not be public.

Use real PHP booleans

Write true and false without quotation marks. In PHP, the string 'false' is truthy, so quoting it can turn a setting on rather than off.

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

Enable WP_DEBUG and log errors

Add the constants in the correct location

Open wp-config.php and place this block before the comment /* That's all, stop editing! Happy blogging. */:

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

Save the file, then load the site once to confirm that the configuration still parses. With this setup, WordPress writes to wp-content/debug.log by default while keeping messages out of normal HTML responses.

Use a custom log path when the default location is unsuitable

Instead of true, WP_DEBUG_LOG can be a valid file path. A custom location is useful when the web root is publicly reachable or when your host centralizes logs outside wp-content. The directory must exist and be writable by the PHP process. Keep the path outside public access when the hosting layout permits it, and restrict permissions to the administrators or service account that needs to inspect it.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
define( 'WP_DEBUG_LOG', '/path/managed-by-your-host/wordpress-debug.log' );

The exact path is environment-dependent; do not copy the example path literally unless it exists on your server. After changing it, generate a fresh test error and verify that entries arrive in the intended file.

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

What each line does

  • WP_DEBUG: activates WordPress’s debug mode and broad PHP reporting. Without it, the companion constants are inert.
  • WP_DEBUG_LOG: records errors, warnings, notices, and calls made through PHP’s error_log(). A value of true selects wp-content/debug.log; a valid path selects that file.
  • WP_DEBUG_DISPLAY: prevents WordPress from placing diagnostics in generated HTML when set to false.
  • display_errors: the PHP-level safeguard that keeps server-generated errors from being printed even if another configuration layer would display them.

Reproduce the failure deliberately

A log is useful only when it contains entries from the failing request. After saving the configuration, repeat the exact action that breaks: open the affected page, submit the form, run the Ajax action, call the REST endpoint, or wait for the scheduled task. Record the approximate time and the account or URL involved so you can match the request to the correct log lines.

  1. Clear your browser’s assumptions about the failure: use a private window or sign out if permissions might change the code path.
  2. Perform one failing action at a time. Avoid refreshing repeatedly while you are trying to identify the first event.
  3. For Ajax, REST, and WP-Cron problems, check the log even when the page looks normal; these requests may never render the error in visible HTML.
  4. Repeat the action once after noting the first result. A repeatable entry is easier to distinguish from an unrelated warning generated by another request.

Find and read wp-content/debug.log

Open the newest entries first

Through SSH, SFTP, or the hosting file manager, open wp-content/debug.log, unless you configured a custom path. Start at the bottom or use your log viewer’s newest-first option. Note the timestamp, severity, file, line number, message, and stack trace.

Understand the information in an entry

  • Severity: PHP Fatal error normally stops the request; warnings and notices may allow it to continue; deprecations often identify code that needs updating but may not explain the immediate outage.
  • File and line: the location where PHP reported the problem. It can be a symptom rather than the original cause, especially when the file belongs to WordPress core.
  • Message: describes the failed operation, missing class or function, invalid argument, type mismatch, or other condition.
  • Trace: shows the calls that led to the failure. The first plugin or theme function in that chain is often the most useful lead.

Do not automatically blame the file named in the final line. A plugin may pass bad data into a core function, so read upward through the trace and identify the first non-core component involved. Compare the timestamp with the action you just performed before changing anything.

Confirm which plugin, theme, or custom code is responsible

Use controlled isolation on staging

Once the log names a component, test the hypothesis in staging rather than making several production changes at once:

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
  1. Make a copy or restore point so you can return to the failing state.
  2. Deactivate the implicated plugin, or switch to a known-good theme if the trace points there.
  3. Repeat the same page load, form submission, Ajax call, REST request, or scheduled action.
  4. Compare the new log entries and response. If the failure disappears, reactivate or switch components one at a time to confirm the boundary.
  5. Apply the smallest corrective change, update, configuration adjustment, or rollback that resolves the confirmed cause.

Isolation is stronger evidence than a filename alone. A component can appear in a trace because it is the caller, while an incompatible extension, theme hook, or earlier data error is the real trigger.

When the error occurs before normal administration loads

If the dashboard cannot load, use the hosting file manager or SFTP to rename the implicated plugin directory temporarily, or use another server-side method your host provides to disable it. Treat that as a recovery action, not a diagnosis: restore the original name after staging confirms the cause, and avoid deleting files during an investigation.

Diagnose fatal errors and Recovery Mode

WordPress 5.2 introduced Recovery Mode to keep a fatal plugin or theme error from permanently locking users out. When WordPress detects a qualifying fatal, it can pause the faulty component for the recovery session and provide an administrative route to investigate it.

Use Recovery Mode as a way back in

  • Use the recovery link delivered by WordPress, if available, to enter the dashboard with the failing component paused.
  • Read the newest log entry while the failure is fresh.
  • Update, disable, or correct the named component in staging first, then retest the original request.

When development needs the original fatal behavior

Recovery Mode can intercept the fatal that a developer is trying to inspect. In a development environment, the wp-config handbook documents:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true );

This keeps the full fatal visible for development diagnosis. Do not enable it casually on a public production site: removing the safety net can leave visitors facing an unrecoverable error instead of a controlled recovery path.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.

Keep errors hidden from visitors while collecting evidence

Displaying a stack trace in page HTML can reveal server paths, database details, usernames, request data, and implementation clues. A public site should therefore log diagnostics without printing them:

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

Check both layers. Setting WP_DEBUG_DISPLAY to false controls WordPress output, while display_errors prevents PHP itself from emitting messages. If a hosting control panel or another configuration file overrides PHP settings, verify the resulting behavior with an authenticated test rather than assuming the override was accepted.

Protect the debug log

Why the file is sensitive

wp-content/debug.log may record paths, function names, request context, warnings, and data supplied to failing code. If the file is reachable through the web server, anyone who discovers its URL could read information intended for administrators. Site Health treats visitor-visible errors and logs in potentially public locations as security risks.

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

Practical safeguards

  • Inspect logs through SSH, SFTP, or an authenticated file manager instead of linking them from a public page.
  • Use a protected custom path outside the public web root when your host supports it.
  • Limit file and directory permissions to the accounts that require access.
  • Do not paste unredacted log entries into public support forums; remove paths, credentials, tokens, email addresses, and submitted form data.
  • Delete or securely archive the log after the diagnosis, according to your organization’s retention policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common debugging situations

The site shows “There has been a critical error”

Keep display errors disabled, reproduce the page request, and inspect the newest fatal entry. Record the file, line, message, and first plugin or theme function in the trace. Use Recovery Mode if WordPress offers it; otherwise isolate the named component in staging or temporarily disable it through an authenticated server method.

The page looks fine, but an Ajax feature fails

Repeat the action and immediately inspect the log. Ajax failures often happen in a separate request, so the diagnostic message may never appear in the page HTML. Match the timestamp to the browser’s request and then test the implicated component independently.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

A scheduled task fails with no visitor-facing symptom

Trigger or wait for the scheduled event, note its execution time, and read the corresponding log entries. Because WP-Cron activity is off-screen, a log is often the only record of a warning or fatal generated by the task.

You see only notices or deprecations

A notice or deprecation is not automatically the cause of a visible outage. Correlate it with the failing request, then look for the first fatal or warning at the same time. If the site works, plan a controlled update or code change rather than suppressing the message blindly.

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

The log remains empty

  • Confirm that WP_DEBUG is the unquoted boolean true.
  • Confirm that WP_DEBUG_LOG is also enabled and that you are checking the configured path.
  • Verify the directory and file are writable by the PHP process.
  • Generate a fresh, known failing request; an old page load will not create a new entry.
  • Check whether the host routes PHP errors to a separate server log or blocks writes to the selected location.

Visitors see PHP errors despite the configuration

Recheck that WP_DEBUG_DISPLAY is the real boolean false, not the string 'false', and that @ini_set( 'display_errors', 0 ); is present. Look for another configuration layer that turns PHP display errors back on. Test with an authenticated request and remove any public output before continuing.

Optional tools for deeper investigation

The basic log is the starting point, not the only diagnostic instrument. For database-query analysis, script and CSS debugging, or code-level work, the official WordPress debugging handbook covers additional options such as SCRIPT_DEBUG, SAVEQUERIES, debugging plugins, automated tests, and step debugging. Enable only the tool needed for the question you are answering, and keep performance-heavy instrumentation on staging whenever possible.

When to move beyond the log

  • Use query-focused instrumentation when the symptom is a slow or incorrect database result rather than a PHP exception.
  • Use script debugging when a non-minified asset or source-map detail is needed to understand a browser-side failure.
  • Use a debugger or automated test when the same code path must be inspected repeatedly with controlled inputs.

Restore production-safe settings

Debugging is temporary. Once the cause is understood and the fix is verified:

  1. Set WP_DEBUG back to false.
  2. Remove temporary overrides such as WP_DISABLE_FATAL_ERROR_HANDLER and the PHP display setting.
  3. Delete or securely archive wp-content/debug.log or the custom log file.
  4. Confirm that visitors no longer receive diagnostic HTML and that the affected request still works.
  5. Check the file location and permissions so an abandoned log cannot remain publicly readable.

Leaving debug mode enabled indefinitely increases the chance of exposing internals and fills the log with unrelated warnings. The finished state should be a tested fix, no visitor-visible diagnostics, and no casually accessible historical log.

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

Quick reference: which approach fits the situation?

Approach Errors displayed? Where evidence goes Best use Main caution
Debug on, display on Yes, in generated responses Page output and possibly logs Short-lived local development inspection Can disclose sensitive details; unsuitable for public traffic.
Debug on, log on, display off No wp-content/debug.log or a valid custom path Controlled diagnosis on a live-facing site Protect and remove the log after use.
Debug off No debug output No WordPress debug log from these settings Normal production operation after the issue is resolved You lose diagnostic detail until logging is deliberately re-enabled.
Recovery Mode Uses a controlled recovery flow WordPress log plus recovery notice Regaining administrative access after a fatal plugin or theme error It can pause the component, so confirm the fix separately in staging.

Final diagnostic checklist

  • Back up the site or switch to staging before editing configuration.
  • Place the constants before the “That’s all, stop editing!” comment.
  • Use unquoted true and false.
  • Keep WP_DEBUG_DISPLAY false and PHP display_errors off when visitors may reach the site.
  • Reproduce the exact page, form, Ajax, REST, or cron failure.
  • Read the newest entry in wp-content/debug.log, or the configured custom path.
  • Record severity, timestamp, file, line, message, and the first plugin or theme function in the trace.
  • Confirm the suspected component by isolating it one change at a time in staging.
  • Protect the log while it exists, then restore production settings and remove the file.

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.