1 Executive Summary
MTS WP Performance Engine is an enterprise-grade WordPress plugin that provides a complete performance control center — not just a caching solution. It continuously measures, optimizes, and monitors WordPress site performance through a systematic Scan → Detect → Recommend → Optimize → Verify → Monitor workflow.
At a Glance
| Metric | Detail |
|---|---|
| Price | ₹7,999 One-Time (no subscriptions) |
| Total Classes | 42 PHP classes across 9 modules |
| Admin Pages | 17 dedicated management screens |
| Scanner Types | 6 specialized scanners |
| Optimizers | 7 optimization modules with rollback |
| REST API Endpoints | 8 authenticated endpoints |
| WP-CLI Commands | 8 command groups |
| Test Coverage | 132 test methods across 8 test suites |
| External Dependencies | Zero (no third-party libraries) |
2 Problem Statement — Why WordPress Needs This
2.1 The WordPress Performance Crisis
WordPress powers over 43% of the web, yet performance remains its most persistent challenge. According to Google's web vitals data:
- 70% of WordPress sites fail Core Web Vitals thresholds
- Average LCP on WordPress is 4.2 seconds (target: <2.5s)
- Average page weight has grown 340% in the past 5 years
- 53% of mobile users abandon sites taking longer than 3 seconds to load
2.2 Why Existing Solutions Fall Short
| Approach | What It Does | What It Misses |
|---|---|---|
| Cache Plugins | Serve static HTML | Don't optimize assets, database, or images |
| CDN Services | Edge delivery | Don't address origin server issues |
| Image Optimizers | Compress images | Don't address CSS, JS, or database |
| DB Cleanup Tools | Remove revisions/transients | Don't optimize frontend assets |
| Asset Optimizers | Minify CSS/JS | Don't monitor performance over time |
2.3 The Gap MTS WP Performance Engine Fills
No single WordPress plugin provides the complete cycle of scanning → detection → recommendation → safe optimization → verification → continuous monitoring. MTS WP Performance Engine is designed as a performance control center that addresses all layers of the WordPress stack simultaneously.
3 Product Overview & Key Differentiators
3.1 What Makes This Different
Performance Scanning
6 specialized scanners analyze every layer of your WordPress site — from server response times to database health.
Safe Optimization
Every optimization has Preview → Apply → Rollback. Safe mode prevents accidental damage. Never irreversible without confirmation.
Continuous Monitoring
Scheduled scans track performance trends over time. See historical scores and detect regressions before users notice.
Zero Dependencies
No external libraries, no API calls, no telemetry. Everything runs on your server. Your data never leaves.
3.2 Feature Comparison Matrix
| Feature | MTS Engine | Cache Plugins | Optimizer Plugins |
|---|---|---|---|
| Performance Scoring | ✓ Weighted algorithm | ✗ | ✗ |
| Core Web Vitals Monitoring | ✓ TTFB, queries, memory | ✗ | ✗ |
| CSS Optimization | ✓ Minify, critical, unused | Partial | ✓ |
| JS Optimization | ✓ Minify, defer, delay | Partial | ✓ |
| Image Optimization | ✓ Lazy, WebP, AVIF, responsive | ✗ | Partial |
| Font Optimization | ✓ Preload, preconnect, display | ✗ | Partial |
| Database Cleanup | ✓ Full cleanup + autoload | ✗ | Partial |
| Cache Diagnostics | ✓ Detection + recommendations | ✓ (creates cache) | ✗ |
| CDN Configuration | ✓ Detection + setup | ✗ | ✗ |
| Rollback Safety | ✓ Per-module rollback | ✗ | ✗ |
| Performance History | ✓ 90-day trend tracking | ✗ | ✗ |
| REST API | ✓ 8 endpoints | Some | Some |
| WP-CLI | ✓ 8 commands | ✗ | ✗ |
| WooCommerce Safe | ✓ Auto-detect + exclude | Varies | Varies |
| Telemetry/Tracking | ✗ Zero | Some | Some |
4 Technical Architecture
4.1 High-Level Architecture
┌─────────────────────────────────────────────────────────────────────────┐ │ MTS WP Performance Engine │ ├─────────────────────────────────────────────────────────────────────────┤ │ │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌───────────┐ │ │ │ Scanner │ │ Optimization │ │ Frontend │ │ Monitoring │ │ │ │ Engine │ │ Engine │ │ Optimizer │ │ Engine │ │ │ │ │ │ │ │ │ │ │ │ │ │ ┌──────────┐ │ │ ┌──────────┐ │ │ ┌──────────┐ │ │ ┌───────┐ │ │ │ │ │Core Vitals│ │ │ │ CSS │ │ │ │ CSS │ │ │ │Cron │ │ │ │ │ │ Assets │ │ │ │ JS │ │ │ │ JS │ │ │ │Beacon │ │ │ │ │ │ Images │ │ │ │ Images │ │ │ │ Fonts │ │ │ │Alerts │ │ │ │ │ │ Database │ │ │ │ Fonts │ │ │ │ Cache │ │ │ └───────┘ │ │ │ │ │ Security │ │ │ │ Database │ │ │ │ Headers │ │ │ │ │ │ │ │Compatibil.│ │ │ │ Cache │ │ │ └──────────┘ │ │ │ │ │ │ └──────────┘ │ │ │Heartbeat │ │ │ │ │ │ │ │ │ Score Calc │ │ └──────────┘ │ │ │ │ │ │ │ └──────────────┘ │ Rollback │ └──────────────┘ └───────────┘ │ │ │ Manager │ │ │ └──────────────┘ │ │ │ ├─────────────────────────────────────────────────────────────────────────┤ │ Integration Layer │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌───────────┐ │ │ │ REST API │ │ WP-CLI │ │ Admin UI │ │ AJAX │ │ │ │ 8 endpoints │ │ 8 commands │ │ 17 pages │ │ handlers │ │ │ └──────────────┘ └──────────────┘ └──────────────┘ └───────────┘ │ │ │ ├─────────────────────────────────────────────────────────────────────────┤ │ WordPress Integration Layer │ │ wp_head | wp_footer | script_loader_tag | send_headers | │ │ cron_schedules | rest_api_init | admin_menu | admin_enqueue_scripts │ └─────────────────────────────────────────────────────────────────────────┘
4.2 Module Dependency Map
mts-wp-performance-engine.php ← Plugin Bootstrap │ ├── includes/class-mts-pe-core.php ← Main Orchestrator │ ├── Scanner Engine ← Reads scan data │ ├── Optimization Engine ← Manages optimizers │ ├── Admin Dashboard ← Registers menus │ ├── REST Controller ← API routes │ └── Frontend Hooks ← Applies optimizations │ ├── includes/scanner/ ← 8 Scanner Classes │ ├── class-scanner-engine.php ← Orchestrator │ ├── class-scanner-core-vitals.php ← TTFB, queries, memory │ ├── class-scanner-assets.php ← CSS/JS analysis │ ├── class-scanner-images.php ← Image detection │ ├── class-scanner-database.php ← DB health │ ├── class-scanner-security.php ← Security config │ ├── class-scanner-compatibility.php ← Plugin/theme detection │ └── class-performance-score.php ← Weighted scoring │ ├── includes/optimization/ ← 9 Optimization Classes │ ├── class-optimization-engine.php ← Orchestrator │ ├── class-optimizer-css.php ← CSS minify/critical/unused │ ├── class-optimizer-js.php ← JS minify/defer/delay │ ├── class-optimizer-images.php ← Lazy/WebP/AVIF │ ├── class-optimizer-fonts.php ← Preload/preconnect │ ├── class-optimizer-database.php ← Cleanup/vacuum │ ├── class-optimizer-cache.php ← Headers/browser cache │ ├── class-optimizer-heartbeat.php ← Frequency control │ └── class-rollback-manager.php ← State snapshots │ ├── includes/admin/ ← 19 Admin Classes ├── includes/api/ ← 3 REST API Classes ├── includes/cli/ ← 2 WP-CLI Classes └── includes/frontend/ ← 2 Frontend Classes
4.3 File Structure
mts-wp-performance-engine/ ├── mts-wp-performance-engine.php ← Bootstrap (PSR-4 autoloader) ├── composer.json ← Dev dependencies only ├── uninstall.php ← Cleanup on uninstall │ ├── includes/ │ ├── class-mts-pe-core.php ← Main orchestrator │ ├── class-mts-pe-activator.php ← DB tables, defaults, cron │ ├── class-mts-pe-deactivator.php ← Cleanup on deactivation │ │ │ ├── scanner/ ← 8 files │ ├── optimization/ ← 9 files │ ├── admin/ ← 19 files │ ├── api/ ← 3 files │ ├── cli/ ← 2 files │ └── frontend/ ← 2 files │ ├── assets/ │ ├── css/admin.css ← Admin styling (CSS variables) │ └── js/ │ ├── admin-dashboard.js ← Dashboard interactivity │ ├── admin-scan.js ← Scan trigger + progress │ ├── admin-charts.js ← Canvas-based history charts │ └── admin-settings.js ← Settings form enhancements │ ├── languages/mts-wp-performance-engine.pot ← Translation template ├── tests/ ← 10 test files └── doc/ ← Documentation
5 Module Specifications
5.1 Scanner Engine
| Scanner | Class | What It Analyzes | Key Metrics |
|---|---|---|---|
| Core Vitals | Mts_Pe_Scanner_Core_Vitals | Server response, queries, memory | TTFB, query count, memory peak, page size |
| Assets | Mts_Pe_Scanner_Assets | CSS/JS files, render-blocking | File sizes, blocking count, inline count |
| Images | Mts_Pe_Scanner_Images | Media library optimization | Lazy loading status, WebP support, large images |
| Database | Mts_Pe_Scanner_Database | DB health and bloat | Autoload size, revisions, transients, orphans |
| Security | Mts_Pe_Scanner_Security | Server config, caching, headers | SSL, object cache, page cache, security headers |
| Compatibility | Mts_Pe_Scanner_Compatibility | Plugin/theme conflicts | WooCommerce, builders, cache plugins, CDN |
5.2 Performance Score Algorithm
The weighted scoring algorithm calculates a 0–100 score based on category weights:
| Category | Weight | What It Measures |
|---|---|---|
| Core Web Vitals | 40% | TTFB, query count, memory usage, page size, object cache |
| Assets | 20% | Render-blocking resources, CSS/JS sizes, deferred scripts |
| Images | 15% | Lazy loading, WebP support, oversized images |
| Database | 15% | Autoload size, revisions, expired transients, orphans |
| Security | 10% | SSL, object cache, page cache, security headers |
5.3 Optimization Engine
| Module | Capabilities | Safety Features |
|---|---|---|
| CSS Optimizer | Minification, critical CSS, unused detection | Exclusion list, rollback |
| JS Optimizer | Minification, defer, delay (async execution) | jQuery exclusion, per-script control |
| Image Optimizer | Lazy loading, WebP/AVIF, responsive images | Excluded pages, above-fold detection |
| Font Optimizer | Preload, preconnect, font-display swap | Google Fonts auto-detect |
| Database Optimizer | Revisions, transients, orphans, autoload | Dry-run, configurable limits |
| Cache Optimizer | Cache-control headers, browser caching | Smart TTL per page type |
| Heartbeat Optimizer | Frequency control, screen disable | Per-screen granularity |
6 Scanning Engine — Deep Dive
6.1 Timing Mechanism
The scanner hooks into WordPress at two critical points to measure server response time:
6.2 Asset Analysis
The asset scanner introspects WordPress's global $wp_styles and $wp_scripts registries to analyze all enqueued resources without modifying them. It measures:
- Individual file sizes by reading from disk
- Render-blocking status (no
defer/asyncattribute) - Inline vs. external resource counts
- jQuery dependency chains
6.3 Database Health Analysis
Direct database queries (using $wpdb->prepare()) analyze:
- Autoload size: Total bytes of options marked
autoload=yes - Revisions: Count and estimated storage of post revisions
- Expired transients: Transients past their timeout
- Orphaned meta: Post meta with no parent post
- Table overhead: MySQL fragmentation per table
6.4 Compatibility Detection
The compatibility scanner uses multiple detection methods:
| Detection Method | Examples |
|---|---|
| Class existence checks | class_exists('WooCommerce') |
| Constant checks | defined('ELEMENTOR_VERSION') |
| Active plugin list | Scans wp_options active_plugins |
| Drop-in detection | object-cache.php existence |
7 Optimization Engine — Deep Dive
7.1 Optimization Lifecycle
User clicks "Optimize"
│
▼
┌───────────────────┐
│ Safe Mode Check │──── Enabled? ──── Return preview + confirm
└───────────────────┘
│ Disabled
▼
┌───────────────────┐
│ Store State │ ← Snapshot current state for rollback
│ (Rollback Mgr) │
└───────────────────┘
│
▼
┌───────────────────┐
│ Apply Changes │ ← Modify files, options, or hooks
│ (Per Module) │
└───────────────────┘
│
▼
┌───────────────────┐
│ Record Action │ ← Log timestamp, module, result
└───────────────────┘
│
▼
┌───────────────────┐
│ Fire Action Hook │ ← do_action('mts_pe_optimization_applied')
└───────────────────┘
│
▼
Return Result
7.2 Rollback Manager
The rollback manager stores state snapshots before each optimization. Each module captures its own state format:
| Module | What's Stored | Rollback Action |
|---|---|---|
| CSS | Minified file list, critical CSS | Remove minified files, clear critical CSS |
| JS | Modified/deferred/delayed file lists | Remove minified files, clear defer/delay |
| Images | Conversion records | Remove filter hooks, clear records |
| Database | Deletion counts (revisions, transients) | Informative only (deletions are permanent) |
| Fonts | Modified file lists | Remove preload/preconnect hooks |
| Cache | Headers modification flag | Remove send_headers hook |
| Heartbeat | Modification flag | Remove heartbeat_settings filter |
8 Admin UI Architecture
8.1 Menu Structure
The plugin registers a top-level WordPress admin menu with 17 sub-pages organized into logical groups:
MTS Performance (dashicons-performance) │ ├── Dashboard ← Score card, vitals, opportunities ├── Performance Scan ← Run scan, view results ├── Core Web Vitals ← Detailed vitals with history │ ├── ── Assets ───────────── ├── Assets ← CSS/JS file table with sizes ├── CSS ← Minify, critical CSS, unused ├── JavaScript ← Minify, defer, delay ├── Images ← Lazy, WebP, AVIF, responsive ├── Fonts ← Preload, preconnect, display │ ├── ── System ───────────── ├── Database ← Cleanup controls ├── Cache ← Diagnostics ├── CDN ← Configuration │ ├── ── Insights ─────────── ├── Recommendations ← Priority-based suggestions ├── Monitoring ← Scheduled scan config ├── History ← Performance trends │ ├── ── Configuration ────── ├── Settings ← Global options ├── Tools ← Export, cleanup └── System Info ← PHP, MySQL, server details
8.2 UI Design Principles
- Card-based layout: Every page uses the
.mts-pe-cardcomponent - CSS custom properties: Consistent theming via CSS variables
- No React build step: Vanilla JavaScript with jQuery for WP compatibility
- AJAX-driven: All actions use AJAX with nonce verification
- Responsive: CSS Grid + media queries for mobile support
8.3 Dashboard Components
Score Circle
SVG-based circular progress indicator with animated stroke-dashoffset. Color changes based on score (green/yellow/red).
Vitals Grid
4-column grid showing LCP, INP, CLS, TTFB with color-coded status badges.
Opportunities
Click-through cards linking to specific optimization pages with issue counts.
History Chart
Canvas-rendered sparkline chart showing performance score trends over time.
9 REST API Specification
9.1 Endpoint Reference
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /mts-pe/v1/scan | Run full performance scan | manage_options |
| GET | /mts-pe/v1/metrics | Get latest scan metrics | manage_options |
| GET | /mts-pe/v1/history | Get performance history | manage_options |
| GET | /mts-pe/v1/recommendations | Get optimization recommendations | manage_options |
| GET | /mts-pe/v1/settings | Get current settings | manage_options |
| POST | /mts-pe/v1/settings | Update settings | manage_options |
| POST | /mts-pe/v1/optimize | Run optimization for a module | manage_options |
| POST | /mts-pe/v1/rollback | Rollback optimization | manage_options |
| GET | /mts-pe/v1/system-info | Get system information | manage_options |
9.2 Authentication
All endpoints require manage_options capability. The plugin uses WordPress application passwords or nonce-based authentication for admin users. The X-WP-Nonce header is used for AJAX requests from the admin dashboard.
9.3 Response Format
10 WP-CLI Integration
10.1 Command Reference
| Command | Description | Options |
|---|---|---|
wp mts-performance scan | Run full performance scan | --format=table|json |
wp mts-performance status | Show current performance status | --format=table|json|yaml |
wp mts-performance optimize | Run optimizations | --module=css|js|... --force --dry-run |
wp mts-performance cleanup | Database cleanup | --dry-run |
wp mts-performance report | Generate performance report | --format=table|json|csv |
wp mts-performance history | Show performance history | --format=table|json |
wp mts-performance rollback | Rollback last optimization | <module> |
wp mts-performance settings | View/update settings | [<key>] [<value>] |
10.2 Example Usage
11 Security Architecture
11.1 Security Layers
Capability Checks
Every AJAX handler and REST endpoint verifies current_user_can('manage_options') before processing.
Nonce Verification
All state-changing requests require valid nonces via check_ajax_referer() or wp_verify_nonce().
Input Sanitization
All user input is sanitized with sanitize_text_field(), absint(), esc_url_raw() before processing.
Output Escaping
All echoed output uses esc_html(), esc_attr(), esc_url(), or wp_kses_post().
Prepared SQL
All database queries use $wpdb->prepare() with proper placeholders. No raw SQL interpolation.
No Telemetry
Zero external API calls. No data leaves the server. No tracking, no analytics, no phone-home.
12 Performance Safety & Rollback
12.1 Safe Mode
By default, the plugin operates in Safe Mode. When enabled, every optimization must be explicitly confirmed by the user before changes are applied. The flow:
- User clicks "Optimize" on a module
- Plugin shows a preview of what will change
- User must confirm (or toggle safe mode off)
- Plugin stores current state for rollback
- Plugin applies the optimization
12.2 Rollback System
The rollback manager maintains up to 10 state snapshots per module. Each snapshot captures the exact state before optimization was applied. Rollback restores the previous state by:
- Removing generated/minified files
- Clearing stored optimization records
- Removing WordPress filter/action hooks
- Restoring option values
12.3 Compatibility Exclusions
Before any optimization, the compatibility scanner checks for conflicts:
| Plugin/Theme | What's Excluded |
|---|---|
| WooCommerce | Checkout scripts, payment gateways, cart fragments |
| Elementor | Editor assets, widget scripts |
| Divi Builder | Visual builder scripts and styles |
| Bricks Builder | Builder frontend assets |
| WPBakery | Editor and frontend assets |
| Cache Plugins | Skips if another cache plugin is active |
13 Compatibility Matrix
13.1 WordPress Compatibility
| Requirement | Minimum | Recommended | Tested |
|---|---|---|---|
| WordPress | 6.4 | 6.7+ | 6.4 – 7.1 |
| PHP | 8.2 | 8.3 | 8.2.12 |
| MySQL | 5.7 | 8.0+ | 8.0 |
| MariaDB | 10.4 | 10.6+ | 10.6 |
13.2 Plugin Compatibility
| Plugin | Status | Notes |
|---|---|---|
| WooCommerce | Compatible | Auto-detected, safe exclusions applied |
| Elementor | Compatible | Editor assets excluded from optimization |
| Divi Builder | Compatible | Builder scripts excluded |
| Bricks Builder | Compatible | Frontend assets excluded |
| WPBakery | Compatible | Editor assets excluded |
| WP Super Cache | Coexists | Does not create its own cache |
| WP Rocket | Coexists | Detects and skips conflicting ops |
| LiteSpeed Cache | Coexists | Detects and skips conflicting ops |
14 Data Flow & Storage
14.1 WordPress Options Used
| Option Key | Type | Purpose |
|---|---|---|
mts_pe_settings | Array (serialized) | All plugin settings in a single option |
mts_pe_last_scan | Array (JSON) | Most recent scan results |
mts_pe_history | Array (capped at 90) | Historical scan scores |
mts_pe_rollback | Array (per module) | Rollback state snapshots |
mts_pe_optimization_log | Array (capped at 100) | Optimization action log |
mts_pe_css_minified | Array (handle → URL) | Minified CSS file mapping |
mts_pe_js_modified | Array (handle → URL) | Minified JS file mapping |
mts_pe_images_converted | Array | Image conversion records |
mts_pe_cache_headers | Boolean | Cache headers applied flag |
mts_pe_heartbeat_modified | Array | Heartbeat modification records |
14.2 Custom Database Table
15 Technical Specifications
| Specification | Detail |
|---|---|
| Language | PHP 8.2+, JavaScript (ES6+) |
| WordPress Coding Standards | WPCS 3.0 compliant |
| Autoloading | Custom SPL autoloader (PSR-4 + WordPress naming) |
| Database | 1 custom table, wp_options for settings |
| Admin UI | PHP-rendered pages, vanilla JS, CSS custom properties |
| API | WordPress REST API (namespace: mts-pe/v1) |
| CLI | WP-CLI (command: wp mts-performance) |
| Cron | WordPress Cron (configurable hourly/daily/weekly) |
| Asset Loading | Conditional, per admin page only |
| File Size | ~350KB total (PHP + CSS + JS) |
| Memory Usage | ~36MB peak (standard WP load) |
| External Dependencies | None (zero third-party libraries) |
| Telemetry | None (zero external API calls) |
| Translation Ready | Yes (.pot file included) |
| License | GPL-2.0-or-later |
16 Developer Hooks & Filters
16.1 Action Hooks
| Hook | Parameters | Fired When |
|---|---|---|
mts_pe_scan_complete | $results (array) | After a full performance scan completes |
mts_pe_optimization_applied | $module, $result | After an optimization is applied |
mts_pe_optimization_rolled_back | $module, $result | After an optimization is rolled back |
16.2 Filter Hooks
| Filter | Parameters | Purpose |
|---|---|---|
mts_pe_performance_score | $score, $results | Modify the calculated performance score |
mts_pe_excluded_scripts | $excluded (array) | Add scripts to the exclusion list |
mts_pe_excluded_styles | $excluded (array) | Add styles to the exclusion list |
mts_pe_scan_results | $results (array) | Modify scan results before storage |
17 Testing Strategy
17.1 Test Suites
| Test File | Tests | Covers |
|---|---|---|
| test-security.php | 13 | Nonces, capabilities, sanitization, escaping |
| test-scanner.php | 22 | All 6 scanners, scoring algorithm, full scan |
| test-optimization.php | 22 | Apply/rollback for all 7 modules, safe mode |
| test-database.php | 14 | Revisions, transients, orphans, cleanup |
| test-rest-api.php | 14 | All endpoints, auth, permissions |
| test-wp-cli.php | 16 | CLI commands, help docs |
| test-compatibility.php | 13 | Plugin/theme detection |
| test-cron.php | 16 | Scheduling, intervals, history |
18 Deployment & Requirements
18.1 Pricing
18.2 Server Requirements
| Component | Minimum | Notes |
|---|---|---|
| PHP | 8.2 | Required for typed properties, enums, readonly |
| WordPress | 6.4 | Block API, modern REST API |
| MySQL | 5.7 | JSON support required |
| Memory | 128MB | PHP memory_limit |
| Execution Time | 30s | For database cleanup operations |