Fast, zero-dependency WordPress performance analyzer that catches critical issues before they crash your site.
Versioning: See
dist/README.mdfor the current released version. The version in the dist README (and the main bash script header) is the canonical source of truth.
WordPress sites fail in production because of performance antipatterns that slip through code review:
- π₯ Unbounded queries (
posts_per_page => -1) that fetch 50,000 posts and crash the server - π N+1 query patterns that turn 1 request into 1,000 database calls
- π₯ Missing capability checks that let subscribers delete your entire site
- π Insecure deserialization that opens remote code execution vulnerabilities
- π§² Debug code in production (
var_dump,console.log) that exposes sensitive data
WP Code Check catches these issues in seconds β before they reach production.
If you're using an AI coding assistant (Cursor, GitHub Copilot, Augment, etc.):
- Open
dist/TEMPLATES/_AI_INSTRUCTIONS.mdin your editor - Ask your AI: "Please review this document and what can I do with this tool?"
Your VS Code Agent will guide you through scanning WordPress plugins and themes, creating templates, and interpreting results.
| Feature | WP Code Check | WPCS | PHPStan-WP |
|---|---|---|---|
| Zero dependencies | β Bash + grep only | β Requires PHP, Composer | β Requires PHP, Composer |
| Runs anywhere | β Local, CI/CD, any OS | ||
| WordPress-specific | β WP performance focus | ||
| Speed | β Scans 10K files in <5s | ||
| Production-tested | β Real-world patterns | β Industry standard | β Type-focused |
| AI Supercharged | β Built-in AI-assisted triage | β No AI support | β No AI support |
# Clone the repository
git clone https://github.com/Hypercart-Dev-Tools/WP-Code-Check.git
cd WP-Code-Check
# Run against your WordPress plugin/theme
./dist/bin/check-performance.sh --paths /path/to/your/pluginβββ CRITICAL CHECKS (will fail build) βββ
βΈ Unbounded posts_per_page [CRITICAL]
β FAILED
./includes/query-helpers.php:45: 'posts_per_page' => -1
βΈ Debug code in production [CRITICAL]
β FAILED
./admin/js/admin.js:293: debugger;
βββ SUMMARY βββ
Errors: 2
Warnings: 0
β Check failed with 2 error(s)
WP Code Check provides two complementary analysis tools for complete coverage:
- 30+ WordPress-specific checks in under 5 seconds
- Critical: Unbounded queries, insecure deserialization, localStorage sensitive data, client-side serialization, direct database queries without $wpdb->prepare()
- High: Direct superglobal manipulation, unsanitized superglobal read, admin functions without capability checks, WooCommerce N+1 patterns, AJAX without nonce validation, unbounded SQL, expensive WP functions in polling
- Medium: N+1 patterns, transients without expiration, HTTP requests without timeout, unsafe RegExp construction, PHP short tags, WooCommerce Subscriptions queries without limits
- Low: Timezone-sensitive patterns
See full check list.
- 6 architectural rules that catch design-level antipatterns
- Duplication detection: Find duplicate functions across files
- State management: Catch direct state mutations bypassing handlers
- Configuration centralization: Eliminate magic strings and hardcoded values
- Query optimization: Context-aware N+1 detection in loops
- Error handling: Ensure graceful failure for HTTP/file operations
- Production readiness: Flag debug code and TODO comments
β οΈ Experimental: Functional but may have false positives. Best for code reviews and learning. See experimental README for complete usage guide.
See Golden Rules documentation.
# Human-readable text (default)
./dist/bin/check-performance.sh --paths .
# JSON for CI/CD integration
./dist/bin/check-performance.sh --paths . --format json
# Auto-generated HTML reports
# Opens in browser automatically (local development)Manage technical debt in legacy codebases:
# Generate baseline from current state
./dist/bin/check-performance.sh --paths . --generate-baseline
# Future scans only report NEW issues
./dist/bin/check-performance.sh --paths .Save scan configurations for frequently-checked projects:
# Create template
./dist/bin/run my-plugin
# Reuse template
./dist/bin/run my-pluginSee HOWTO-TEMPLATES.md for details.
Validate findings and identify false positives with AI assistance:
# After running a scan, use AI to triage the results
# AI analyzes the JSON log and provides:
# - Summary stats (reviewed, confirmed, false positives)
# - Overall narrative assessment
# - Recommendations for next stepsFeatures:
- β
False Positive Detection - Identifies common false positives (e.g.,
phpcs:ignorecomments, adjacent sanitization) - β Confidence Scoring - Rates overall assessment confidence (high/medium/low)
- β Actionable Recommendations - Prioritized list of issues to fix
- β Executive Summary - 3-5 paragraph narrative for stakeholders
See TEMPLATES/_AI_INSTRUCTIONS.md for detailed triage workflow.
Automatically create GitHub issues from scan results with AI triage data:
# Create issue from latest scan (specify repo)
./dist/bin/create-github-issue.sh \
--scan-id 2026-01-12-155649-UTC \
--repo owner/repo
# Or use template's GitHub repo (if GITHUB_REPO is set in template)
./dist/bin/create-github-issue.sh --scan-id 2026-01-12-155649-UTC
# Generate issue body without creating (no repo needed)
# Useful for manual issue creation or when repo is not specified
./dist/bin/create-github-issue.sh --scan-id 2026-01-12-155649-UTC
# β Saves to dist/issues/GH-issue-2026-01-12-155649-UTC.mdFeatures:
- β Auto-formatted Issues - Clean, actionable GitHub issues with checkboxes
- β AI Triage Integration - Shows confirmed issues vs. needs review
- β Template Integration - Reads GitHub repo from project templates (optional)
- β Interactive Preview - Review before creating the issue
- β Graceful Degradation - Works without GitHub repo (generates issue body only)
- β
Persistent Issue Files - Saves to
dist/issues/with matching filename pattern for easy manual copy/paste
Requirements:
- GitHub CLI (
gh) installed and authenticated (only for creating issues) - Scan with AI triage data (
--ai-triageflag)
WP Code Check supports the Model Context Protocol (MCP), allowing AI assistants like Claude Desktop and Cline to directly access scan results.
Quick Start:
# 1. Install Node.js dependencies
npm install
# 2. Configure Claude Desktop (macOS)
# Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"wp-code-check": {
"command": "node",
"args": ["/absolute/path/to/wp-code-check/dist/bin/mcp-server.js"]
}
}
}
# 3. Run a scan
./dist/bin/check-performance.sh --paths /path/to/plugin
# 4. Ask Claude: "Show me the latest WP Code Check scan results"Features:
- β Direct AI Access - AI assistants can read scan results without copy/paste
- β
Latest Scan Resource -
wpcc://latest-scanreturns most recent JSON - β
Historical Scans -
wpcc://scan/{id}accesses specific scans - β
HTML Reports -
wpcc://latest-reportreturns formatted reports - β Zero Config - Works with existing JSON output
Supported AI Tools:
- Claude Desktop (macOS, Windows)
- Cline (VS Code extension)
- Any MCP-compatible AI assistant
Developer Guide:
For AI agents using MCP:
// Read latest scan
const scan = await readResource("wpcc://latest-scan");
// Parse findings
const findings = JSON.parse(scan.text).findings;
// Analyze critical issues
const critical = findings.filter(f => f.severity === "CRITICAL");See PROJECT/1-INBOX/PROJECT-MCP.md for complete MCP documentation.
AI Agent Instructions:
When analyzing WP Code Check results via MCP:
- Read
wpcc://latest-scanfor JSON data - Check
ai_triagefield for confirmed vs. false positives - Prioritize CRITICAL and HIGH severity findings
- Suggest fixes with code examples
- Reference specific file paths and line numbers
WP Code Check is a complete code quality suite with multiple specialized tools:
| Tool | Type | Purpose | Speed |
|---|---|---|---|
| Quick Scanner | Bash | 30+ WordPress antipatterns | <5s |
| JSON to HTML Converter | Python | Beautiful HTML reports from scan logs | <1s |
| GitHub Issue Creator | Bash | Auto-create GitHub issues from scan results | <2s |
| Slack Integration | Bash | CI/CD notifications | Instant |
| Baseline Manager | Built-in | Track technical debt over time | N/A |
| Project Templates | Built-in | Save scan configurations | N/A |
| Tool | Type | Purpose | Speed | Status |
|---|---|---|---|---|
| Golden Rules Analyzer | PHP | 6 architectural rules with semantic analysis | ~10-30s | Experimental - may have false positives |
Choose your workflow:
- Fast CI/CD: Quick Scanner only (zero dependencies, stable)
- Deep Review: Quick Scanner + Golden Rules (experimental)
- Legacy Audit: Quick Scanner + Baseline + Golden Rules (experimental)
All scan outputs are organized in the dist/ directory:
| Directory | Contents | Git Tracked | Purpose |
|---|---|---|---|
dist/logs/ |
JSON scan results (*.json) |
β No | Machine-readable scan data |
dist/reports/ |
HTML reports (*.html) |
β No | Human-readable scan reports |
dist/issues/ |
GitHub issue bodies (GH-issue-*.md) |
β No | Manual copy/paste to GitHub or project management apps |
dist/TEMPLATES/ |
Project templates (*.txt) |
β Yes | Reusable scan configurations |
Filename Pattern: All outputs use matching UTC timestamps for easy correlation:
dist/logs/2026-01-13-031719-UTC.json
dist/reports/2026-01-13-031719-UTC.html
dist/issues/GH-issue-2026-01-13-031719-UTC.md
name: WP Code Check
on: [push, pull_request]
jobs:
quick-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Quick Scan
run: |
git clone https://github.com/Hypercart-Dev-Tools/WP-Code-Check.git
./WP-Code-Check/dist/bin/check-performance.sh --paths . --format json --strict
deep-analysis:
runs-on: ubuntu-latest
needs: quick-scan
steps:
- uses: actions/checkout@v3
- name: Golden Rules Analysis (Experimental)
run: |
git clone https://github.com/Hypercart-Dev-Tools/WP-Code-Check.git
php ./WP-Code-Check/dist/bin/experimental/golden-rules-analyzer.php . --fail-on=errorwp-code-check:
script:
- git clone https://github.com/Hypercart-Dev-Tools/WP-Code-Check.git
- ./WP-Code-Check/dist/bin/check-performance.sh --paths . --format json- User Guide - Complete command reference and examples (includes canonical version number)
- Template Guide - Project template system
- Changelog - Version history and development progress
- AI Agent Guide - WordPress development guidelines for AI assistants
- Disclosure Policy - Responsible disclosure and public report publication policy
# Basic scan
./dist/bin/check-performance.sh --paths /path/to/plugin
# JSON output for CI/CD
./dist/bin/check-performance.sh --paths . --format json
# Strict mode (warnings fail the build)
./dist/bin/check-performance.sh --paths . --strict
# Generate baseline for legacy code
./dist/bin/check-performance.sh --paths . --generate-baseline
# Verbose output (show all findings)
./dist/bin/check-performance.sh --paths . --verbose
# Disable logging
./dist/bin/check-performance.sh --paths . --no-logWe welcome contributions! Please see CONTRIBUTING.md for guidelines.
Note: Contributors must sign a Contributor License Agreement (CLA) before their first pull request can be merged. This is a one-time process that ensures legal clarity for the dual-license model.
WP Code Check is dual-licensed:
The core tool is licensed under the Apache License 2.0, which means:
- β Free for everyone - Use for personal or commercial projects
- β Modify and distribute - Fork, customize, and share
- β Patent protection - Includes explicit patent grant
- β No restrictions - Use in proprietary software
See LICENSE for full terms.
For organizations that need priority support, advanced features, or SLA guarantees, we offer commercial licenses:
- π― Priority Support - Guaranteed response times, dedicated channels
- π Advanced Features - Custom rules, white-label reports, team collaboration
- π’ Enterprise Features - SSO, audit logs, on-premise deployment
- π Service Level Agreements - Uptime guarantees and compliance support
See LICENSE-COMMERCIAL.md for details and pricing.
Contact: noel@hypercart.io
WP Code Check is developed by Hypercart, a DBA of Neochrome, Inc.
- π Website: WPCodeCheck.com
- π§ Support: noel@hypercart.io
- π Issues: GitHub Issues
Made with β€οΈ for the WordPress community