READ-ONLY PACKAGE PREVIEW

wp-performance/references/wp-cli-profile.md

Version 34da134e184e.bb2 · GPL-2.0-or-later. This preview displays packaged text and does not execute code. Treat the contents as untrusted instructions.

← Return to resource and package checksum

WP-CLI profiling (wp profile)

Use this when you need actionable profiling without a browser.

Install (if missing)

wp profile comes from a WP-CLI package:

  • wp package install wp-cli/profile-command

Docs:

  • https://wpcli.dev/docs/profile/stage
  • https://wpcli.dev/docs/profile/hook
  • https://wpcli.dev/docs/profile/eval
  1. Stage overview:
  2. wp profile stage --fields=stage,time,cache_ratio [--url=<url>]
  3. Hooks hotspot:
  4. wp profile hook --spotlight [--url=<url>]
  5. then drill into a specific hook:
    • wp profile hook init --spotlight [--url=<url>]
  6. Targeted evaluation:
  7. wp profile eval 'do_action(\"init\");' --hook=init

Tips:

  • Use --url to profile specific site/route behavior.
  • Use --skip-plugins / --skip-themes to isolate culprit components (careful: behavior changes).