- This repository contains the WPVulnerability WordPress plugin. Treat every change as production-grade code for a widely distributed plugin.
- Maintain compatibility with WordPress 4.7 – 6.9 and PHP 5.6 – 8.4. Test new logic against modern PHP (8.x) while ensuring legacy behaviour remains intact.
- Keep plugin headers, translation domains (
wpvulnerability), and public APIs stable. Preserve backward compatibility for filters, actions, and CLI commands.
wpvulnerability.phpis the loader; feature-specific logic is split acrosswpvulnerability-*.phpfiles and supporting classes in the root directory.- CLI tooling lives in
class-wpvulnerability-cli.phpandclass-wpvulnerability-config-cli.php. - Assets (JS/CSS) reside in
assets/; language files live inlanguages/. - Automated tests are under
tests/(PHPUnit). Supporting scripts live inbin/.
- Install PHP dependencies:
composer install
- Ensure the PHP interpreter used locally supports all required extensions (curl, json, mbstring, xml, zip) to mirror typical WordPress hosting.
- Activate the plugin inside a WordPress installation by symlinking or copying the repository folder into
wp-content/plugins/.
Run all commands from the repository root after making changes:
- Static analysis:
vendor/bin/phpstan analyse --memory-limit=1G
- Unit tests:
vendor/bin/phpunit
- Coding standards (WordPress Coding Standards via PHPCS):
Target PHP files must follow PHPCS + WPCS with tab indentation. Use
vendor/bin/phpcs
vendor/bin/phpcbfonly when confident it will not introduce breaking formatting.
- Follow WordPress Coding Standards for PHP, JS, and CSS. Use tabs for indentation; align multi-line arrays or arguments with spaces only where WPCS allows.
- PHPDoc blocks are mandatory for classes, interfaces, traits, properties, and methods/functions. Include summaries,
@since,@param,@return, and@throwswhen relevant. - Prefer early returns, strict comparisons, and guard clauses to keep functions readable.
- Do not introduce new global functions/constants unless required. Extend existing classes or create prefixed classes (e.g.,
WPVulnerability_*). - All user-facing strings must be translatable with the
wpvulnerabilitytext domain and properly escaped (esc_html__,esc_attr__,wp_kses_post, etc.). - Keep array syntax compatible with PHP 5.6 (no trailing commas in function calls, no short array destructuring).
- When modifying database or HTTP interactions, leverage WordPress APIs (e.g.,
$wpdb,wp_remote_get()). Avoid blocking synchronous calls inside hooks that run on every request.
- Sanitize, validate, and escape all input and output. Use the most specific helper (
sanitize_text_field,absint,wp_kses_post, etc.). - Use capability checks before mutating data (e.g.,
current_user_can( 'manage_options' )). - All mutating requests (forms, AJAX, REST) must include a nonce and verify it with
wp_verify_nonce(). - Never store secrets or credentials in the repository. Read them from environment variables or WordPress options stored securely.
- Review each change for potential privilege escalation, CSRF, and XSS vectors.
- Add or update PHPUnit tests in
tests/for new behaviour. Structure tests to run independently of a full WordPress install when possible. - Use data providers for coverage across multiple WordPress/PHP versions when logic diverges.
- For regression fixes, include tests that reproduce the previous bug.
- Code formatted and PHPCS/WPCS clean.
- PHPStan and PHPUnit pass locally; document any pre-existing failures.
- Added/updated tests covering new logic.
- Documentation (README, docblocks, inline comments) updated.
- Security review completed (nonces, sanitization, escaping, capability checks).
- Confirm backwards compatibility for public hooks, filters, and CLI commands.
- Write commit messages in English using
<type>: <description>where<type>might befix,feat,docs, etc. - Do not amend or squash existing commits; keep history linear and descriptive.
- Summaries and PR descriptions must be in English and highlight testing performed.
- After committing, use the
make_prtool to draft the PR message once all work is complete.