wp profile <command>

Quickly identify what's slow with WordPress.

EXAMPLES EXAMPLES

# See an overview for each stage of the load process.
$ wp profile stage --fields=stage,time,cache_ratio
+------------+---------+-------------+
| stage      | time    | cache_ratio |
+------------+---------+-------------+
| bootstrap  | 0.7994s | 93.21%      |
| main_query | 0.0123s | 94.29%      |
| template   | 0.792s  | 91.23%      |
+------------+---------+-------------+
| total (3)  | 1.6037s | 92.91%      |
+------------+---------+-------------+

# Dive into the hooks for a given state
$ wp profile stage bootstrap --fields=hook,time,cache_ratio --spotlight
+--------------------------+---------+-------------+
| hook                     | time    | cache_ratio |
+--------------------------+---------+-------------+
| muplugins_loaded:before  | 0.2335s | 40%         |
| muplugins_loaded         | 0.0007s | 50%         |
| plugins_loaded:before    | 0.2792s | 77.63%      |
| plugins_loaded           | 0.1502s | 100%        |
| after_setup_theme:before | 0.068s  | 100%        |
| init                     | 0.2643s | 96.88%      |
| wp_loaded:after          | 0.0377s |             |
+--------------------------+---------+-------------+
| total (7)                | 1.0335s | 77.42%      |
+--------------------------+---------+-------------+

Top ↑

INSTALLING INSTALLING

Use the wp profile command by installing the command's package:

wp package install wp-cli/profile-command

Once the package is successfully installed, the wp profile command will appear in the list of available commands.

Top ↑

SUBCOMMANDS SUBCOMMANDS

Name Description
wp profile eval

Profile arbitrary code execution.

wp profile eval-file

Profile execution of an arbitrary file.

wp profile hook

Profile key metrics for WordPress hooks (actions and filters).

wp profile stage

Profile each stage of the WordPress load process (bootstrap, main_query, template).

Command documentation is regenerated at every release. To add or update an example, please submit a pull request against the corresponding part of the codebase.