WP Debug Toolkit 1.2.0 is LIVE. Get $300 discount on the lifetime deal now
Use Discount Code WPDTLTD

Start a query recording from the Database Queries card at WP Debug Toolkit › Overview by clicking Record or pressing Q. WPDT captures every SQL query executed during the active window and stops logging the moment you end the session. For a defined capture window, a timed recording automatically stops after a duration you set between 10 seconds and one hour, so you do not need to manually stop it after reproducing a behavior.

In This Guide

How Recording Works

The Database Monitor captures queries in two distinct modes: recording and always-on logging. Understanding the difference helps you choose the right approach before you start.

Recording captures only while active: In the recording mode, WPDT logs queries only during an active recording session. When you stop the recording, no further queries are written to disk. The log reflects exactly the window you chose to capture, which makes recording the right choice for diagnosing a specific page behavior without accumulating data from unrelated requests. 

Because WPDT writes query data to encrypted files on disk rather than to the WordPress database, the act of recording does not add overhead to the database activity you are measuring.

Always-on logs every request continuously: The always-on logging mode captures every query on every request without a defined window. This generates significant disk I/O on active sites and is intended only for development environments. See Always-On Logging Mode for the full trade-off and how to enable it.

Before You Begin

  • The Database Monitor requires an active Query module license. This feature is part of the WP Debug Toolkit Query Viewer, Unlimited, and Lifetime Pro plans.
  • The standalone Viewer App must be installed separately from the WordPress plugin. The Query Viewer interface, where recordings appear, lives inside the Viewer App, not in wp-admin.

Step-by-Step Instructions

How to Start and Stop a Manual Recording

Step 1: Open the Database Queries Card

Navigate to WP Debug Toolkit › Overview and locate the Database Queries card. The card displays the current Mode (shown as Enhanced when the db.php drop-in is active, or Basic when running on SAVEQUERIES alone) and four action buttons: Record, View Queries, Settings, and Clear Logs.

wp-debug-toolkit-database-queries-card

Step 2: Configure and Start the Recording

Click Record. WPDT opens the Record Queries dialog before starting any session.

Set three options before starting:

  • Recording duration: Choose a preset between 10s, 30s, 1m, or 5m, or select Custom to enter a specific duration. The recording stops automatically when the timer expires. The available range for Custom is 1 second to 1 hour.
  • Recording tag: WPDT pre-populates this field with a timestamp-based label (for example, recording-20260523-1548). Edit it to something descriptive if you want to identify this session by behavior rather than time, for example, checkout-slow-query. Tags appear in the Query Viewer’s filter panel, so you can filter to see only the queries from a particular session. Without a tag, you identify recordings by timestamp alone.
  • Enable shareable URL: Toggle this ON if you want to generate a link that others can use to trigger the recording. Leave it OFF for a private local session.

Click Start Recording (Xs). The button label reflects your selected duration. If you toggled Enable Shareable URL ON, the button label changes to Generate URL instead. The dialog closes and the recording begins immediately.

wp-debug-toolkit-queries-recording-settings

Step 3: Reproduce the Behavior You Want to Capture

Navigate to the page, trigger the action, or complete the workflow you are investigating. WPDT captures every SQL query that runs through WordPress’s wpdb class during the active window. 

Step 4: Stop the Recording

The Database Queries card header displays a live countdown timer and a square stop button in the top-right corner while recording is active. The recording stops automatically when the timer reaches zero. To end the session before the timer expires, click the square stop button.

wp-debug-toolkit-query-recording-in-progress

✅ What You Should See When the session ends, your queries are available in the Query Viewer. To view them, click View Queries on the Database Queries card, then press F to open the filter panel and select your recording tag under Recordings. The query table and statistics header update to show only queries from that session. If you did not assign a tag, you can filter by time range to isolate the recording.

WP-CLI Equivalent

Developers who prefer the command line can start and stop recordings with two confirmed commands:

bash
# Start a timed recording -- duration is in seconds (1 to 3600)
# This example starts a 5-minute recording
wp dbtk query-log start --duration=300

# Omitting --duration starts a recording with a 1-hour safety ceiling
wp dbtk query-log start

# Stop an active timed recording before the timer expires
# Does not disable always-on logging if it was already on before the recording started
wp dbtk query-log stop

# Enable persistent always-on logging (different mode from a timed recording)
# Captures every query on every request with no defined window
# Use in development environments only -- see Always-On Logging Mode
wp dbtk query-log on

# Disable persistent always-on logging
# Does not stop an active timed recording -- use stop for that
wp dbtk query-log off

Note that start/stop and on/off control two distinct modes. Running stop when no recording is active may disable global logging unexpectedly. You should run wp dbtk query-log status first if you are unsure of the current state.

Additionally, –duration expects an integer number of seconds. Passing a human-readable value, such as 5m, will not work as expected. For example, (int)”5m” evaluates to five seconds, not five minutes.

Common Issues and How to Fix Them

Query Viewer Shows No Queries After a Recording

Likely cause: The recording ran, but no page loads occurred during the active window. WPDT captures queries only from requests that happen while the session is open. If no pages were loaded, the log is empty.

Fix: Start a new recording, then load at least one page on the front end or in the admin before the timer expires or you click stop. The Query Viewer empty state reads: “No queries found. Try adjusting your filters or check if query logging is enabled.”

Frequently Asked Questions

What is the difference between recording queries and always-on logging?

Recording captures queries only during a defined window from when you click Record to when you stop it. Always-on logging continuously captures every query on every request, which generates significant disk I/O on active sites and is not recommended for production. Use recording for most debugging sessions and always-on logging only in development environments where continuous capture is needed.

Does the recording capture queries from the admin dashboard as well as the front end?

Yes. Recording is a site-wide, server-side flag, not a browser screen recorder. Every WordPress request that hits the server during the active window is captured. This includes admin pages, front-end pages, REST calls, and AJAX requests. To profile both contexts, load both during the recording period.

One timing note: the request that starts the recording may not log its own queries. Start the session first, then navigate to the page or trigger the action you want to capture.

Related Documentation

Always-On Logging Mode – Not working with a defined window? Here’s when to skip recording and log everything, and what that costs on a live site.

Query Recording and Shareable URLs – How to tag a completed recording and send it to another developer without giving them admin access.

The db.php Drop-in – What WPDT installs to intercept queries at the database level, and what to do if it conflicts with another plugin.

On this page
Try WP Debug Toolkit
The best error log viewer with amazing developer tools to help you troubleshoot your WordPress site securely and efficiently. Something something more.