There are two tools we have available as an extension to WP CLI that can greatly help you learn all about your WordPress site’s performance. And, with the diagnose information WP Profile and WP Docter provide, you’ll have a very good chance of finding whatever is slowing down the performance of your WordPress site!
So let’s dive in!
WP Profile is a command line tool developed to help in diagnosing problems with slow WordPress websites. The main idea of the extension to WP CLI is to split the loading process into stages and then give the ability to track each one of them.
You can always use
--help after a to see subcommands. Here’s the subcommands for
eval– Profile arbitrary code execution. Arbitrary code execution (ACE) is used to describe an attacker’s ability to execute arbitrary commands or code on a target website.
eval file– Profile execution of an arbitrary file.
hook– Profile key metrics for WordPress hooks (actions and filters).
stage– Profile each stage of the WordPress load process (bootstrap, main_query, template).
The most important subcommand here is
stage. We use that to see the different load times for each stage of your site. These are the bootstrap, main_query and template.
bootstrap– is where WordPress is setting itself up, loading plugins and the main theme, and firing the init hook.
main_query– is how WordPress deals with requests and process them in its queries.
template– is where WordPress determines which theme template to render based on the main query, and renders it.
You then get a lot of useful information about load times, cache hits, query time, etc. But the most important is the total time each stage takes. If you see a high number of seconds one stage takes, you know where to look.
You can also investigate further. Let’s say you see a high spike in
bootstrap, then you can run:
wp profile stage bootstrap --spotlight (
--spotlight filters out unnecessary load times that takes ~0s seconds)
Here you’ll get a full view on the load times for your plugins, theme, init etc. If you see that
plugins_loaded uses a while to load, you can run the
hook option to investigate load times of your plugins. Something like this:
wp profile hook plugins_loaded --spotlight
And that’s the main gist of WP Profile!
WP Doctor is a tool developed to help in diagnosing problems with WordPress websites such as failed update, blank page, upload issues, etc.
Most times you’ll only need to run the check on all instances. The command will then be:
wp doctor check --all
Here are the checks the tool will run and what they mean:
core-verify-checksums– Check if WordPress verifies against its checksums.
file-eval– Checks files on the filesystem for regex pattern eval\(.*base64_decode\(.* which in many cases indicates suspicious code.
cache-flush– Detects the number of occurrences of the wp_cache_flush() function.
autoload-options-size– Warns when autoloaded options size exceeds the threshold of 900 kb.
constant-savequeries-falsy– Confirms expected state of the
SAVEQUERIEScauses WordPress to save a backtrace for every SQL query, which is a resource heavy operation, thus using
SAVEQUERIESin production is discouraged.
constant-wp-debug-falsy– Verifies if wp debug is enabled by checking the state of the state of the
core-update– Verifies if the application is up to date. Errors are shown when new WordPress minor release is available; warns for a major release.
cron-count– Checks the count of cron jobs and displays an error when there is an excess of 50 total cron jobs registered.
cron-duplicates– Checks the count of duplicate cron jobs and displays an error when there is an excess of 10 duplicate cron jobs registered.
option-blog-public– Verifies if the website is publicly available by checking the value of the
plugin-active-count– Shows a warning when there are more than 80 plugins activated.
plugin-deactivated– Warns when more than 40% of plugins are deactivated.
plugin-update– Shows a warning when there are plugin updates available.
theme-update– Warns when there are theme updates available.
php-in-upload– Shows a warning when a PHP file is present in the Uploads folder.
language-update– Checks if there is a new version of the installed language.
You will either get the status
error. Errors should be fixed immediately and warnings should be looked at, at least.
If you have any further questions regarding these tools, please contact our support team at servebolt.com!
Give us your feedback on this article
Servebolt has launched Accelerated Domains!
Accelerated Domains is a service that greatly improves and optimizes your site on these four areas: Performance, Scalability, Security and the Carbon footprint of your website.