Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/jpeevi/debug-helper-for-wordpress/archive/refs/heads/main.zipSimple, lightweight, and developer-friendly debugging utilities for WordPress.
Debug Helper For WordPress is a lightweight debugging plugin designed to make inspecting PHP variables easier during WordPress theme and plugin development.
With familiar dump() and dumpAndDie() functions, developers can quickly inspect arrays, objects, and other PHP values without repeatedly writing print_r(), var_dump(), or custom debugging code.
The plugin provides readable output, automatic source file and line number detection, support for multiple variables, and context-aware safeguards to help prevent debugging output from interfering with WordPress AJAX and REST API responses.
No complicated setup. No external dependencies. Just simple debugging when you need it.
Features
- Quick Variable Inspection — Debug PHP values using simple
dump()anddumpAndDie()functions. - Multiple Variable Support — Inspect several variables in a single call.
- Source Location Tracking — Automatically display the originating filename and line number.
- Readable Output — Display formatted debugging information using optional HTML
<pre>blocks. - Type Information — Switch between
print_r()andvar_dump()output. - HTML-Safe Output — Escape debugging output to prevent unintended HTML rendering.
- WordPress-Aware Debugging — Suppress output in detected AJAX, REST, and JSON response contexts.
- CLI Compatibility — Support plain-text debugging in command-line environments.
- Access Protection — Restrict HTTP debugging output to users with the
manage_optionscapability. - Lightweight by Design — No external libraries, complex configuration, or unnecessary overhead.
Requirements
- PHP 8.0 or newer
- WordPress 5.6 or newer
WP_DEBUGenabled
Installation
- Download the plugin ZIP or clone the repository.
- Place the plugin directory inside
wp-content/plugins/. - Activate Debug Helper For WordPress from the WordPress admin dashboard.
- Enable debugging in your
wp-config.phpfile:
define('WP_DEBUG', true);
The debugging functions are registered only when WP_DEBUG is enabled.
Usage
Basic debugging
Inspect a variable using the dump() function.
dump($user);
Pretty-print output
Display output inside a styled HTML <pre> block.
dump($user, prettyPrint: true);
Include variable types
Use var_dump() instead of print_r() to inspect variable types and values.
dump($user, dumpType: true, prettyPrint: true);
Debug multiple variables
Inspect multiple variables in a single call.
dump($user, false, true, $settings, $post);
Additional variables are passed after the original three arguments to maintain backward compatibility.
Dump and terminate
Display debugging information and stop execution.
dumpAndDie($settings, prettyPrint: true);
Note: In suppressed HTTP contexts such as detected REST API, AJAX, and JSON requests, dumpAndDie() does not terminate execution.
Available Functions
dump()
Displays debugging information without terminating execution.
dump(
mixed $variable,
bool $dumpType = false,
bool $prettyPrint = false,
mixed ...$additionalVariables
): void
dumpAndDie()
Displays debugging information and terminates execution when output is permitted.
dumpAndDie(
mixed $variable,
bool $dumpType = false,
bool $prettyPrint = false,
mixed ...$additionalVariables
): void
Parameters
| Parameter | Type | Description |
|---|---|---|
$variable |
mixed |
Primary variable to inspect |
$dumpType |
bool |
Use var_dump() instead of print_r() |
$prettyPrint |
bool |
Enable formatted HTML output |
$additionalVariables |
mixed ... |
Additional variables to inspect |
Safety and Compatibility
Debug Helper For WordPress is intended for local development and debugging environments.
- Functions are available only when
WP_DEBUGis enabled. - HTTP debugging output is restricted to users with the
manage_optionscapability. - Output is suppressed in detected REST API, AJAX, and JSON request contexts.
- HTML output is escaped for safer browser rendering.
- CLI output uses plain text rather than HTML formatting.
- The plugin avoids modifying HTTP
Content-Typeheaders.
Important: Disable debugging in production environments and remove unnecessary debugging calls before deployment.
Changelog
v1.1.0 — Improved Debugging Experience
- Added automatic filename and line number tracking.
- Added support for dumping multiple variables.
- Improved formatted debugging output.
- Added consistent HTML escaping for both output modes.
- Fixed unwanted HTML closing tags in CLI output.
- Removed unsolicited
Content-Typeheader changes. - Improved compatibility with AJAX, REST, and JSON requests.
- Added permission checks for HTTP debugging output.
- Updated plugin include paths to be relative to the plugin file.
- Preserved existing function signatures and named arguments.
Philosophy
Debugging tools should make development easier, not introduce additional complexity.
Debug Helper For WordPress focuses on providing essential debugging functionality through a small, straightforward API that integrates naturally into existing WordPress development workflows.
Keep it simple. Debug faster. Build better WordPress projects.
Releases
2 releases.
These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.