Plugins to debug, profile & log errors
By profile, I mean - measure performance.
Find broken links
There is a good overview of available tools.
Xenu Link Sleuth and other 7 things you can do with Xenu.
Other desktop tools are:
- Screaming Frog SEO or alternative: SEO Macroscope
- LinkChecker
I also used desktop site downloaders like Teleport Ultra
Online tools
The most beautiful is W3C official online tool called W3C Link Checker available here.
There is also an ancient looking Dead Link Checker.
Wordpress plugins
There is also a very good Wordpress plugin Broken Link Checker that examines database and detects broken links. It can be time consuming, but it clearly shows you if broken links are from WP posts.
404 logs & redirects
I am using a simple plugin called 404 Error Logger that logs all 404 errors on site.
There is more advanced Redirector plugin that does that same thing plus a lot more about redirecting links.
Log warnings & errors
WP Error Fix WP Error Fix: Track Plugins & Themes Errors in WordPress | WP Solver
We need to /wp-content/plugins/wp-error-fix/application/Service/Model/rest.php
line 58 to $response->status = 'success';
Debug
WPEngine (should be experts in speed) recommend for development: Debug Objects now defunct, and Query Monitor
For most of the following plug-ins, besides setting WP_DEBUG
we also must set define('SAVEQUERIES', true);
in wp-config.php
.
-
Query Monitor is essential plugin for development.
After successful installation, don’t forget to check the symlink of
db.php
. It should be done automatically and can be forced with plugin deactivation and reactivation, with the disabled option Database Cache in W3TC__. Manually, you can do it withln -s wp-content/plugins/query-monitor/wp-content/db.php wp-content/db.php
from the WP folder.I suggest you immediately
Set an authentication cookie
to access the plugin when not logged in.Offical source and documentation: johnbillion/query-monitor, and some info
-
Debug Bar did not impress me. Everything it does, Query Monitor does better. Despite of that, it seems it has a lot of free extensions: Debug Bar and Add-Ons
[Debug Bar Slow Actions is a really useful add-on that records timing spent on Actions/Filters. In slows down the site considerably so should be disabled in production environment.
Note: This interesting add-on conflicts with another plugin - Debug Objects.
Another add-on, Debug Bar Console adds a PHP/MySQL console to the debug bar.
-
Debug Objects is defunct now but was very interesting, and different. It had a lot of useful things for front-end development, but its interface was outdated.
Enable the following, interesting options:
Chromephp
and install the browser extension Chrome LoggerDb Query
HTML Inspector
is perfect as markup quality tool but I believe there are better plugins for thatCache
shows the contents of the cache
Discovering Slow Database Queries
Try installing the WP-CLI package wp package install runcommand/query-debug
created by the creator of WP-CLI himself, Daniel Bachhuber, or the package wp-cli/profile-command
. After installation, you will be able to use the interesting commands wp profile stage
and wp query-debug
, which can assist you in identifying slow database queries and improving performance.
Simpler Query Monitor alternative:
Debug plugins BlackBox Debug Bar for WordPress: Track Queries & Errors | WP Solver
Abandoned and depreciated plugins
- Debug Queries is recommending another plugin by the same author Debug Objects, also defunct in 2022.
Articles: 6 WordPress Plugins for Debugging 5 Must See Query Monitors for WordPress
Development plugins:
MySQL Monitor PHP/MySQL CPU performance statistics Diagnosis
Show page & post info
show current template
Show Current Template What The File
What Template Am I Using is my selected plugin.
Others are also very nice:
- Helpful Information is very useful plugin to
- What Template
WordPress plugin for whoops Rarst/wps · GitHub whoops is a nice little library that helps you develop and maintain your projects better whoops! - php errors for cool kids
Another one: WordPress › Pretty PHP Error Pages « WordPress Plugins
Log Errors into Console
Log server-side messages in browser’s developer console.
Tracy
Tracy | nette/tracy looks amazing and very active.
Has Wordpress plugin: WP Tracy | hlavacm/WP-Tracy
Chrome Logger
Chrome Logger - Server side application debugging
Most languages include their own logging capabilities, but sometimes it is easier to see your logs right in the browser. Chrome Logger is an open protocol. Chrome Logger used to be known as ChromePHP.
Chrome Logger - Chrome Web Store
And in firefox: Console messages — Firefox Source Docs documentation ChromeLogger | burningmoth/burningmoth-chromelogger-firefox
Alternatives that are defunct by now
-
FirePHP, Benchmarking WordPress SQL using FirePHP was a PHP library and Firefox browser extension that allowed developers to log server-side messages to their browser’s developer console. FirePHP has been discontinued in 2011.
-
QuantumPHP: frankforte/quantumphp
When you need to debug
Code adds a backtrace to PHP errors in gist
Get the gist:
wget https://gist.githubusercontent.com/jrfnl/5925642/raw/684479612fbf6d81cd440205f779ee25d3957710/wp-config-debug.php
Add this at the end of wp-config.php
:
require_once(ABSPATH . 'wp-config-debug.php');
Better debug.log
Viewing Experience
Function wp_debug_mode() is defined inside wp-includes/load.php
, it is called only once in
wp-settings.php
. It doesn’t do nothing special.
Still, it is impossible to override it from wp-config.php
as it always sets some value. The only way to change error_reporting
is inside
mu-plugins folder.
How can I stop PHP notices from appearing in wordpress? - Stack Overflow PHP error_reporting Predefined Constants
Log viewers and monitors:
-
WP Log Viewer is gorgeous log viewer. Capability to toggle WP_DEBUG is nice idea.
-
afragen/wp-debugging uses norcross/debug-quick-look debug.log viewer under the hood
WordPress loading sequence
WordPress loading sequence: A guided tour - webdesign defunkt.nu filters - What is the very earliest action hook you can call? - WordPress Development Stack Exchange Between functions.php, widgets and plugins, which is loaded first? - WordPress Development Stack Exchange
Must use plugins are plugins that you won’t manage through the normal plugin admin screens. They are useful if you are building an application in which it makes no sense that end users would enable/disable parts of the application.
Another use for must use plugins is a plugin that loads before all other plugins, because the normal plugins are only loaded further on in wp-settings.
After loading the must use plugins, you get the earliest hook you can
call: muplugins_loaded - Note that there still are no ‘normal’ plugins
loaded at this point. It is the first do_action
inside wp-settings.php
.
add_filter( 'option_active_plugins', array( $this, 'do_disabling' ) );
add_filter( 'site_option_active_sitewide_plugins', array( $this, 'do_network_disabling' ) );
add_action(‘muplugins_loaded’, function () { // your code here });
I like it: WordPress › Error Log Monitor