wp profile finds the plugin before you read forty of them

Profiling a slow WordPress page usually starts with guessing which plugin is responsible, and there is a command that answers it directly.

$ wp package install wp-cli/profile-command

$ wp profile stage --url=https://shop.example/
stage       time     query_time  cache_ratio  hook_count
bootstrap   0.4102s  0.0821s     91.2%        1204
main_query  1.8841s  1.7204s     44.1%        18     ← here
template    0.3120s  0.0410s     88.0%        891

$ wp profile hook pre_get_posts --url=https://shop.example/

Drilling from stage to hook to callback finds the responsible function in about three commands, which is considerably faster than reading forty plugins. The cache_ratio column is the one people skip and is frequently the finding — a stage doing eighteen queries at a 44% hit rate is a missing cache rather than a slow query. It runs on the command line, so it profiles the request without a browser or an admin bar in the way.