WP Manifestindependent plugin directory
manifest / performance / wp-performance-toolkit

WP Performance Toolkit

Performance monitoring, query profiling, asset analysis, and optimization for WordPress.

★ 1stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/labanthegreat/wp-performance-toolkit/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

A WordPress plugin for monitoring and diagnosing performance issues. It profiles database queries, analyzes enqueued assets, tracks object cache efficiency, manages WP-Cron events, and provides toggleable optimizations -- all from an admin dashboard and WP-CLI.

Features

Performance Monitoring

  • Per-request tracking of page generation time, peak memory usage, database query count/time, hooks fired, TTFB, and external HTTP requests
  • Request log stored in a custom database table (auto-pruned to 500 rows)
  • Slowest-hooks ranking by cumulative execution time
  • Hourly trend data and query-count distribution for historical analysis

Database Query Profiler

  • Slow query detection with configurable threshold (default 0.05s, stored in wppt_slow_query_threshold option)
  • Duplicate query detection
  • N+1 query pattern identification
  • Per-table and per-caller query breakdowns
  • Index suggestions for slow queries
  • Requires SAVEQUERIES to be enabled in wp-config.php for full analysis

Asset Analyzer

  • Lists all enqueued scripts and styles with file sizes
  • Identifies render-blocking resources
  • Suggests defer/async candidates
  • Maps each asset to its source (core, plugin, theme, or external)
  • Builds dependency trees

Object Cache Analyzer

  • Detects the active cache backend (Redis, Memcached, APCu, Relay, or default)
  • Tracks cache hit/miss rates
  • Reports per-group memory usage
  • Provides actionable suggestions based on cache state

WP-Cron Manager

  • Lists all scheduled cron events with source identification
  • Detects orphaned events (hooks with no registered callbacks)
  • Supports manual execution, deletion, and rescheduling of events
  • Logs cron execution times

Optimizations Individually toggleable optimizations organized by category:

Key Category Description
disable_emojis Frontend Remove emoji detection script and styles
remove_query_strings Frontend Strip ver query strings from CSS/JS URLs
lazy_load_iframes Frontend Add loading="lazy" to iframes
dns_prefetch Frontend Add preconnect/dns-prefetch hints for common third-party domains
disable_oembed Frontend Remove oEmbed discovery links and endpoints
remove_shortlink Frontend Remove shortlink from headers and HTML head
defer_js Frontend Add defer to front-end scripts (excludes jQuery by default)
critical_css Frontend Inline critical CSS and defer remaining stylesheets
heartbeat_throttle Backend Reduce Heartbeat API interval to 60 seconds
heartbeat_disable Backend Deregister Heartbeat script (except on post editor)
disable_xmlrpc Security Disable XML-RPC and remove X-Pingback header
clean_revisions Database Delete all post revisions (one-shot)
clean_auto_drafts Database Delete all auto-draft posts (one-shot)
clean_trash Database Permanently delete trashed posts (one-shot)
clean_spam_comments Database Delete spam and trashed comments (one-shot)
clean_transients Database Delete expired transients (one-shot)
limit_revisions Database Cap post revisions at 5 per post

Admin Bar Widget

  • Color-coded performance indicator in the admin bar (green < 200ms, yellow < 500ms, red >= 500ms)
  • Shows page load time, memory usage, and query count
  • Links to the dashboard

Admin Dashboard

  • Multi-tab interface: Overview, Queries, Assets, Cron, Object Cache, Optimizations, Settings
  • AJAX-powered optimization toggles
  • Export performance reports as JSON

Requirements

  • WordPress 6.0 or later
  • PHP 8.0 or later

Installation

  1. Upload the wp-performance-toolkit directory to /wp-content/plugins/.
  2. Activate through Plugins > Installed Plugins.
  3. Access the dashboard under Performance in the admin menu.

For full query profiling, add the following to wp-config.php:

define( 'SAVEQUERIES', true );

Note: SAVEQUERIES adds overhead. Enable it only when actively debugging.

WP-CLI Commands

All commands are registered under the wp perf namespace.

wp perf stats

Display aggregate performance statistics.

wp perf stats
wp perf stats --hours=48

Options:

  • --hours=<number> -- Look-back window in hours. Default: 24.

wp perf log

Show recent request log entries.

wp perf log
wp perf log --limit=50

Options:

  • --limit=<number> -- Number of entries to display. Default: 20.

wp perf queries

Analyze database queries from the current request. Requires SAVEQUERIES.

wp perf queries
wp perf queries --slow-only

Options:

  • --slow-only -- Show only queries exceeding the slow-query threshold.

Output includes total query count, total time, slow queries, duplicate queries, N+1 patterns, per-table breakdown, and index suggestions.

wp perf assets

List enqueued scripts and styles with sizes and sources.

wp perf assets

Reports render-blocking resources when detected.

wp perf optimize

View and toggle performance optimizations.

wp perf optimize --list
wp perf optimize --enable=disable_emojis
wp perf optimize --disable=heartbeat_throttle

Options:

  • --list -- Show all optimizations and their current status.
  • --enable=<name> -- Enable an optimization by key.
  • --disable=<name> -- Disable an optimization by key.

wp perf cron

Manage WP-Cron events.

wp perf cron list
wp perf cron orphaned
wp perf cron cleanup

Subcommands:

  • list -- Display all scheduled cron events with next-run time, schedule, source, and overdue status.
  • orphaned -- List cron events whose hooks have no registered callbacks.
  • cleanup -- Remove all orphaned cron events.

wp perf benchmark

Run a page-load benchmark by issuing HTTP requests to a URL.

wp perf benchmark
wp perf benchmark --iterations=20 --url=/sample-page/

Options:

  • --iterations=<number> -- Number of requests. Default: 10.
  • --url=<url> -- URL to benchmark. Default: site home URL.

Reports average, median, min, max, and P95 response times.

Hooks and Filters

wppt_preconnect_domains

Filter the list of domains used for dns-prefetch and preconnect hints when the dns_prefetch optimization is enabled.

add_filter( 'wppt_preconnect_domains', function ( array $domains ): array {
    $domains[] = 'https://cdn.example.com';
    return $domains;
} );

Default domains: fonts.googleapis.com, fonts.gstatic.com, www.google-analytics.com, www.googletagmanager.com, cdn.jsdelivr.net.

wppt_defer_exclude_handles

Filter the list of script handles excluded from deferral when the defer_js optimization is enabled.

add_filter( 'wppt_defer_exclude_handles', function ( array $handles ): array {
    $handles[] = 'my-critical-script';
    return $handles;
} );

Default exclusions: jquery, jquery-core, jquery-migrate, wp-polyfill.

wppt_critical_css

Filter the critical CSS string inlined in <head> when the critical_css optimization is enabled. Return a non-empty string to replace the default.

add_filter( 'wppt_critical_css', function (): string {
    return 'body { margin: 0; } .hero { min-height: 100vh; }';
} );

Settings

Settings are accessible from the dashboard's Settings tab or managed via WP options:

Option Type Default Description
wppt_slow_query_threshold float 0.05 Slow query threshold in seconds
wppt_optimizations array [] Enabled optimizations (key => bool)

Uninstall

On uninstall, the plugin removes:

  • The wppt_request_log database table
  • The wppt_optimizations option
  • The wppt_cron_log option
  • The wppt_slow_query_threshold option

Changelog

2.0.0

  • Added WP-CLI commands (wp perf)
  • Added asset analyzer with render-blocking detection
  • Added object cache analyzer with backend detection
  • Added WP-Cron manager with orphan detection and cleanup
  • Added page-load benchmarking
  • Added hook execution time tracking
  • Added external HTTP request tracking
  • Added TTFB measurement
  • Added DNS prefetch/preconnect optimization
  • Added oEmbed disable, shortlink removal, revision limiting
  • Added defer JS and critical CSS inlining optimizations
  • Added N+1 query pattern detection
  • Added index suggestions for slow queries
  • Added hourly trend and query distribution data
  • Added admin bar color-coded performance widget

1.0.0

  • Initial release
  • Database query profiler with slow query detection
  • Performance monitoring (page time, memory, query count)
  • Toggleable optimizations (emoji removal, query string stripping, XML-RPC disable, iframe lazy loading, Heartbeat control, database cleanup)
  • Admin dashboard
  • JSON report export

License

GPL-2.0-or-later