Skip to main content
GrN.dk

Main navigation

  • Articles
  • Cases
  • Contact
  • Your Digital Project Manager
  • About Greg Nowak
  • Services
  • Portfolio
  • Container
    • Excel Freelancer
    • Kubuntu - tips and tricks
    • Linux Apache MySQL and PHP
    • News
    • Image Gallery
User account menu
  • Log in

Breadcrumb

  1. Home

Debugging WordPress on a Live Site: A Safer Workflow

By Greg Nowak. Last updated 2026-07-16.

When a live WordPress site starts returning 500 errors, showing blank pages, or breaking checkout, every diagnostic change carries business risk. The objective is not simply to ā€œturn debugging on.ā€ It is to gather useful evidence during a short, controlled window while keeping technical details away from customers.

The following workflow helps business owners, operations leads, and agency teams investigate production problems without turning one fault into several. If the issue can be reproduced on staging, work there. When it only happens in production, make one change at a time and agree on a rollback point before starting.

Protect the site before changing anything

Confirm that you have a recent, restorable backup. Then record the time the problem started, the affected URL or user journey, and the most recent changes. Include plugin and theme updates, deployments, PHP upgrades, hosting changes, scheduled jobs, CDN rules, and third-party integrations.

Test the failure once before changing the configuration. Note whether it affects everyone or only particular users, browsers, locations, account types, or transactions. Those details often reveal more than a large undifferentiated error log.

Log errors without displaying them

WordPress recommends using its debugging tools on local or staging installations rather than live sites. When production debugging is unavoidable, edit the existing debug definitions in wp-config.php—do not create duplicates—and place them before the stop-editing comment:

// Temporary production diagnostics: log, but do not display.
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

This normally writes messages to wp-content/debug.log without adding them to rendered pages. PHP’s own documentation also recommends logging instead of displaying errors on production systems.

The default log location may be accessible from the web. Where your server permits it, set WP_DEBUG_LOG to an absolute path outside the public document root:

define( 'WP_DEBUG_LOG', '/secure/path/wp-errors.log' );

Use a path that the PHP process can write to, restrict access, and remove or archive the file when the investigation ends. Logs can contain internal paths, email addresses, request data, and integration responses, so treat them as sensitive operational records.

Read the failure window, not the whole log

Reproduce the problem once, note the exact time, and inspect entries from that window. Prioritise fatal errors and exceptions that align with the failed request. Notices and deprecation warnings deserve maintenance work, but they do not necessarily explain today’s outage.

If debug.log remains empty, inspect the hosting control panel or server-level PHP error log. A syntax error or startup failure can happen before the runtime ini_set() call takes effect, so the WordPress log is not the only source of evidence.

What you observe Investigate first Controlled next test
The failure began after an update The plugin, theme, or file named in the fatal error Deactivate the likely component and reproduce once
Output differs between visitors Page cache, CDN, object cache, then browser cache Purge the relevant layer and retest the same URL
A form or checkout fails PHP log, browser network response, and integration logs Use a safe test transaction or staging reproduction
Scheduled work fails Cron events, loopback requests, and queue logs Run the specific job under controlled conditions
Core admin JavaScript is broken Browser console and network panel Temporarily enable SCRIPT_DEBUG
A focused triage matrix helps prevent unrelated production changes from obscuring the original fault.

Isolate plugins carefully with WP-CLI

If wp-admin is unavailable, WP-CLI can deactivate a suspected plugin without relying on the browser:

wp plugin deactivate plugin-slug

For broader isolation, first record what is active. During an agreed maintenance window, you can deactivate plugins while preserving an essential component:

wp plugin list --status=active
wp plugin deactivate --all --exclude=critical-plugin

Bulk deactivation can interrupt payments, forms, security controls, authentication, caching, and multilingual routing. On a commercial site, it is an incident action rather than a casual test. Start with the component named by the evidence and reactivate known-good plugins promptly.

If a normal plugin prevents WP-CLI from loading WordPress, the global --skip-plugins parameter can help the command start. Must-use plugins still load, however, so this option does not isolate everything.

Clear the cache layer you actually mean

Do not treat WP_CACHE as a universal cache switch. WordPress documents it as a setting that loads wp-content/advanced-cache.php; it does not automatically disable a hosting cache, CDN, persistent object cache, or browser cache.

WP-CLI can flush the WordPress object cache:

wp cache flush

That command does not purge every other cache layer. On multisite installations using a persistent object cache, it will typically affect every site and may create a production performance spike. Identify the cache owner and scope first. A targeted page or CDN purge is preferable when the symptom is limited to one URL.

Use deeper diagnostics only when justified

Leave SCRIPT_DEBUG off unless you are tracing WordPress core JavaScript or CSS. It loads development versions of core assets and is not required for ordinary PHP debugging. Likewise, avoid enabling SAVEQUERIES casually on production because collecting every database query adds overhead.

Check WP_ENVIRONMENT_TYPE as well. If WordPress sees the environment as development and WP_DEBUG has not been defined explicitly, it can enable debugging automatically.

Close the debugging window cleanly

Once you have enough evidence, restore the existing configuration rather than adding another block:

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

Remove or secure the temporary log, restore deactivated plugins, clear only the caches affected by the fix, and test the original customer journey. Record the cause, evidence, changes, and follow-up work so the next person does not have to repeat the investigation.

If payments, memberships, personal data, multisite, recurring jobs, or shared caching are involved, early escalation is usually cheaper than prolonged production experimentation. Greg can help contain the issue, distinguish application faults from infrastructure symptoms, and turn the evidence into a practical repair plan. Get in touch to discuss the site and its current symptoms.

Related on GrN.dk

  • CMS Upgrades in 2026: A PHP Roadmap for WordPress and Drupal Sites
  • WordPress Security Releases Still Need an Ops Runbook for Business Sites
  • AI Crawler Control for Business Websites: Protect Content Without Sacrificing Search Visibility

Need help with this kind of work?

Get help debugging your WordPress site Get in touch with Greg.

Sources

  • Debugging in WordPress
  • Editing wp-config.php
  • wp plugin deactivate
  • wp cache flush
  • PHP Runtime Configuration: Errors and Logging
Last modified
2026-07-16

Tags

  • wordpress
  • Debugging
  • WP-CLI
  • Website Operations
  • Log in to post comments

Review Greg on Google

Greg Nowak Google Reviews

 

Illustrated infographic summarizing: One Timeout, Two Orders: Make AI Actions Safe to Retry
One Timeout, Two Orders: Make AI Actions Safe to Retry
2026-07-25

A timed-out AI action may already have succeeded. Stable keys, durable ledgers, queues and stored results prevent a routine retry from duplicating real work.

Illustrated infographic summarizing: Your AI Visibility Dashboard Needs a Methodology, Not More Charts
Your AI Visibility Dashboard Needs a Methodology, Not More Charts
2026-07-24

A practical framework for measuring AI-search visibility with fixed prompts, repeated tests, separate metrics, retained evidence, and honest reporting.

Illustrated infographic summarizing: AI Admin APIs Are Here—But Your Directory Is Still the Source of Truth
AI Admin APIs Are Here—But Your Directory Is Still the Source of Truth
2026-07-23

New AI admin APIs can automate access and spend controls, but reliable governance still starts with authoritative directory data and clear ownership.

Illustrated infographic summarizing: OpenAI Presence Arrived—But Is Your Workflow Ready for an Agent?
OpenAI Presence Arrived—But Is Your Workflow Ready for an Agent?
2026-07-22

Before an AI agent can take on real work, its workflow needs clear scope, permissions, handoffs, evaluation cases, and production monitoring.

Illustrated infographic summarizing: Chatbot Transcripts Quietly Became a Retention and Redaction Problem
Chatbot Transcripts Quietly Became a Retention and Redaction Problem
2026-07-21

Chatbot transcripts spread across providers, logs and support tools. Here is how to map each copy, redact sensitive data and test deletion properly.

Illustrated infographic summarizing: Cloudflare Service Keys Stop in September: Find Every Caller
Cloudflare Service Keys Stop in September: Find Every Caller
2026-07-20

Cloudflare Service Keys stop working on September 30, 2026. Here is how to find every caller, move to scoped API tokens and avoid a late outage.

Illustrated infographic summarizing: Your AI Workflow Needs an Acceptance Test Before It Meets Customers
Your AI Workflow Needs an Acceptance Test Before It Meets Customers
2026-07-19

A practical way to test AI workflows using realistic scenarios, tool checks, human rubrics, regression suites, and clear release gates.

Three cover candidates for The Goats Were Load-Bearing fanned on a dark background: an ember-lit door, three slow knocks, and a founders' ledger
The Goats Were Load-Bearing: a fantasy where the bill always comes due
2026-07-19

A teaser for the upcoming darkly comic fantasy novel The Goats Were Load-Bearing — a village, a door that must stay poor, and the worst possible time to sell the herd. Readers pick the cover.

Vegan Power game: the yellow player catches falling fruit while a chicken and a cow look on
Vegan Power: The Little Game About Eating Fruit, Not Friends
2026-07-19

Vegan Power is a free browser game where you catch fruit, dodge the animals, protect seven hearts, and chase a better high score.

KotobaMon title screen: the Japanese logo ć‚³ćƒˆćƒćƒ¢ćƒ³ over a low-poly 3D island with monsters, cherry-blossom trees and a trainer.
KotobaMon: Shipping a 3D Browser Game With No Build Step and Self-Hosted Voice
2026-07-19

A look at fantasy.grn.dk, a browser-based 3D game that teaches Japanese with no build step, procedural art and self-hosted AI voice, and what its constraints show about shipping interactive products fast and cheap.

More articles
RSS feed

GrN.dk web platforms, web optimization, data analysis, data handling and logistics.