Start and stop WordPress debug mode from inside a theme or plugin folder. Safely enables WP_DEBUG, WP_DEBUG_LOG, SCRIPT_DEBUG, and SAVEQUERIES in wp-config.php, tails debug.log in real time, and cleanly restores the original config when done. Use when the user says "start debugging", "debug WordPress", "enable debug mode", "stop debugging", or "turn off debug". Designed for working directories inside wp-content/themes/<theme> or wp-content/plugins/<plugin>.
Enable and disable WordPress debug mode safely from inside a theme or plugin directory.
Before any debug operation, resolve the WordPress root paths. The working directory is assumed to be inside wp-content/themes/<theme>/ or wp-content/plugins/<plugin>/.
../../../wp-config.php exists (standard depth from theme/plugin root).../../../../wp-config.php (nested projects like plugin/src/).find / -maxdepth 5 -name wp-config.php -not -path '*/vendor/*' 2>/dev/null | head -5
and ask the user to confirm the correct path.WP_CONFIG.WP_CONTENT — the wp-content/ directory (parent of themes/ or plugins/).DEBUG_LOG as $WP_CONTENT/debug.log.When the user says "start debugging", "debug WordPress", or "enable debug mode":
If ${WP_CONFIG}.pre-debug-backup already exists, warn the user that a debug session may already be active and ask whether to continue or restore first.
cp "$WP_CONFIG" "${WP_CONFIG}.pre-debug-backup"
In $WP_CONFIG, find and comment out (prefix with // ) any existing define() lines for:
WP_DEBUGWP_DEBUG_LOGWP_DEBUG_DISPLAYSCRIPT_DEBUGSAVEQUERIESUse sed or in-place editing. Never duplicate a define() for the same constant.
Add the following block above the line /* That's all, stop editing! */ in $WP_CONFIG:
// >>> WP DEBUG MODE — added by wp-debug skill
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
define( 'SCRIPT_DEBUG', true );
define( 'SAVEQUERIES', true );
@ini_set( 'display_errors', 0 );
// <<< END WP DEBUG MODE
If the /* That's all, stop editing! */ marker is not found, insert the block after the last existing define() statement instead.
truncate -s 0 "$WP_CONTENT/debug.log" 2>/dev/null || touch "$WP_CONTENT/debug.log"
tail -f "$WP_CONTENT/debug.log"
Tell the user:
✅ Debug mode is ON. Reproduce the issue in your browser — errors will appear here in real time. Say "stop debugging" when you're done.
When the user says "stop debugging", "turn off debug", or "disable debug mode":
If ${WP_CONFIG}.pre-debug-backup does NOT exist:
$WP_CONFIG for the // >>> WP DEBUG MODE marker.cp "${WP_CONFIG}.pre-debug-backup" "$WP_CONFIG"
rm "${WP_CONFIG}.pre-debug-backup"
Read $WP_CONFIG and confirm:
// >>> WP DEBUG MODE block is gone.'WP_DEBUG', true exists.Tell the user:
✅ Debug mode is OFF. Original wp-config.php has been restored. The debug.log file is preserved at
wp-content/debug.login case you still need it.
When the user asks to "analyze the log", "check errors", or "what went wrong":
$WP_CONTENT/debug.log.wp-config.php.pre-debug-backup as the backup filename, stored next to the original wp-config.php.wp-config.php to version control.debug.log when stopping — the user may still need it.WP_DEBUG_DISPLAY is set to false so errors are never shown in the browser (safe for staging/live sites).| Constant | Effect |
|-------------------------|---------------------------------------------------------------|
| WP_DEBUG = true | Enables WordPress error reporting |
| WP_DEBUG_LOG = true | Writes errors to wp-content/debug.log |
| WP_DEBUG_DISPLAY = false | Hides errors from the browser (safe for live/staging) |
| SCRIPT_DEBUG = true | Uses unminified core CSS/JS files for easier debugging |
| SAVEQUERIES = true | Stores DB queries in $wpdb->queries for analysis |
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer