The wp dbtk api command group gives developers a terminal-native workflow for discovering, calling, profiling, annotating, and inspecting WordPress REST routes, with output formats suited to CI pipelines, automated scripts, and AI-assisted development sessions.
Conventional REST route discovery requires browsing the API index in a browser, capturing live traffic through a proxy, or running a dedicated HTTP client. None of those approaches integrates cleanly into automated scripts, pre-deployment checks, or the context window of an AI coding agent.
WP Debug Toolkit addresses this with a command-driven schema store that persists route data locally and keeps annotations separate from discovered routes.
Profiling prefers WordPress’s native query log (enabling SAVEQUERIES for the profiled request when it isn’t already defined) so per-query timing reflects real execution time. If SAVEQUERIES was explicitly disabled at bootstrap, profiling falls back to a query-filter capture that still reports accurate query counts and duplicate detection, but flags that per-query timing is unavailable.
Annotations survive repeated discovery runs on the same or different sites, so re-scanning routes never overwrites notes your team has already written.
Start with Discovering Registered Routes if you’re mapping an unfamiliar codebase, or jump directly to Profiling Endpoint Performance if you already know which endpoint you need to investigate.
Discovering Registered Routes →
Map every REST route registered on your WordPress site, including routes added by plugins and themes, with source attribution for each.
Searching and Filtering Routes →
Narrow a large route inventory to the specific paths and namespaces you’re working with, using keyword and filter flags.
View the schema for any individual route, including accepted parameters, authentication requirements, and a summary of what it returns (when annotated), without making a live request.
Profiling Endpoint Performance →
Profile any REST endpoint from the terminal and receive timing, memory, query count, duplicate detection, and per-plugin attribution in structured JSON.
Tracing SQL Queries Per Endpoint →
Diagnose a slow or over-querying endpoint by profiling it and cross-referencing with the Query Logger to isolate which code is responsible.
Annotating Routes with Custom Metadata →
Attach persistent descriptions, safety classifications, and auth notes to routes so your team, or your AI coding agent, can understand endpoint behavior without re-discovering it each session.