Add a Debug Bar to your WordPress website to debug and develop your themes, plugins, etc…
With the plugin you can find every variables you want to debug in the same place and use debug functions to display them.
To fully help you to debug your website you need to add some code to your wp-config.php
file.
define( 'WP_DEBUG', true ); // PHP errors, notices and warnings will be displayed
define( 'SAVEQUERIES', true ); // Display queries in current page
define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true ); // Disable WP Fatal error handler
To debug a simple variable you can use:
<?php dump( $var ); // Dump the variable(s) ?>
To debug a variable and stop the process after you can use:
<?php dd( $var ); // This will die after dumping the variable(s) ?>
This is one of the main aspect of the plugin, to debug variables in a separate place.
The most difficult task when you debug a variable is to deal with container width, with the plugin you have a debug bar where you can add the variables of the current page.
To add a variable to the debug bar you can use the function bellow:
<?php kl_debug_add_var( $var ); ?>
You can add custom tabs in the debug bar to filter you variables:
<?php
kl_debug_add_var(
$var, // The variable you want to debug
'Your variable title', // If you want to name the variable
'The section title', // The tab title
'the-section-slug' // The tab slug
);
?>
Whoops is the framework that we use to display error handling. (cf. Pretty error handler with stack frames)
Download & install the zip archive
The plugin package installer can be downloaded from the WP2E project tab called “code”.
1 – Select the version to download if this option is available otherwise the “latest” version of the main plugin will be used.
2 – After downloading the zip archive install the plugin package installer in you local environment and activate the script from the plugin list.
3 – Under the section “Plugins” of the admin dashboard you should see a new “Dependencies & Licenses” link. Follow the instructions from this panel to finalize the installation of the missing dependencies.
Tips: Use the WP2E panel to add/suggest new dependencies to the local installation. Press F5 in the list of dependencies if the changes are not displayed right away.