WordPress plugin to detect the single plugin causing slowdown or breakage on a specific page using safe loopback tests.
- Safe Loopback Testing - Tests each plugin individually without affecting visitors
- Page Selection - Choose which page to scan from a dropdown of all published pages
- Unlimited Plugin Scanning - Scan all active plugins without limitations
- Custom URL Support - Scan any URL on your site
- Anonymous Telemetry (Premium) - Opt-in data sharing to build a shared plugin performance database (premium feature)
This plugin supports building separate free and premium ZIPs from the same source code. The build mode is configured via the .env file in the plugin directory.
Edit the .env file in the code-medic-slow-site-scanner/ directory:
# Build mode: "free" or "premium"
CODEMEDSSS_MODE=freeRun the build script from the project root:
./scripts/build.shThis creates build/code-medic-slow-site-scanner-${MODE}.zip with the configured mode baked in.
- Free version: Set
CODEMEDSSS_MODE=freein.envbefore building (fully functional) - Premium version: Set
CODEMEDSSS_MODE=premiumin.envbefore building (includes additional telemetry features)
When enabled (premium only), the plugin shares anonymous performance data to help build a shared plugin compatibility database. Users can opt-out via the plugin settings.
Data shared:
- Plugin slugs (anonymized to folder name only)
- Performance delta (in seconds)
- PHP version
- WordPress version
Data NOT shared:
- Site URLs
- Plugin configurations
- Any personally identifiable information
The data is queued and sent asynchronously via wp_cron (hourly) to avoid blocking any requests.
The scanner includes a dropdown that lists all published pages on your WordPress site. All users can:
- Select from all published pages
- Use the "Custom URL" option to scan any URL on their site
This plugin is designed to comply with WordPress.org plugin directory guidelines. The free version is fully functional with no artificial restrictions, while premium features are additional functionality hosted separately.
For detailed information about WordPress.org requirements and our free/premium architecture, see docs/wordpress_requirements.md.
Settings are configured via a .env file in the plugin directory:
# Build mode: "free" or "premium"
# - free: Fully functional scanner without telemetry
# - premium: Includes anonymous telemetry features
CODEMEDSSS_MODE=free
# Supabase configuration for anonymous telemetry (premium only, optional)
CODEMEDSSS_SUPABASE_URL= # Your Supabase project URL (e.g., https://xxxxx.supabase.co)
CODEMEDSSS_SUPABASE_ANON_KEY= # Your Supabase anon/public key
CODEMEDSSS_SUPABASE_TABLE= # Table name (default: telemetry)- Create a Supabase project at https://supabase.com
- Run the SQL scripts in the
sql/folder (in order):sql/01-create-tables.sql- Creates the telemetry tablesql/02-create-indexes.sql- Creates indexes for performancesql/03-set-rls-policies.sql- Enables RLS with secure policiessql/04-create-views.sql- Creates analysis views
- Add your Supabase URL and anon key to the
.envfile
For detailed documentation on the database schema and views, see the SQL scripts in the sql/ folder.
This plugin uses PHPUnit for unit testing.
- Install dependencies:
composer install- Create the WordPress test environment (one-time setup):
mkdir -p /tmp/wordpress
# You'll need to copy or link your WordPress installation here
# or use a proper WordPress test environment like wp-env- Run the tests:
./vendor/bin/phpunittests/bootstrap.php- Test bootstrap file with WordPress function mockstests/TestBootstrap.php- Basic test to verify setuptests/TestResults.php- Tests for results.php functionstests/TestLoopback.php- Tests for loopback.php functionstests/TestScanner.php- Tests for scanner.php functionstests/TestToggle.php- Tests for toggle.php functionstests/TestTelemetry.php- Tests for telemetry.php functions (premium only)
Each test class should:
- Be in the
PIA\Testsnamespace - Extend
PHPUnit\Framework\TestCase - Test one specific file's functions
Example:
<?php
namespace PIA\Tests;
use PHPUnit\Framework\TestCase;
class TestExample extends TestCase
{
public function testSomething()
{
$this->assertTrue( true );
}
}code-medic-slow-site-scanner.php- Main plugin fileadmin/ui.php- Admin interface and AJAX handlersadmin/js/admin.js- Frontend JavaScriptincludes/scanner.php- Core scanning logicincludes/loopback.php- Loopback testingincludes/toggle.php- Plugin toggle functionalityincludes/results.php- Results handlingincludes/telemetry.php- Anonymous telemetry collection