PHPCS ruleset for WordPress projects developed at Haptiq.
Combines WordPress Coding Standards with PHPCompatibilityWP to catch both style violations and WordPress/PHP version compatibility issues.
composer require --dev haptiq/coding-standardsThe Composer installer plugin registers the standard automatically — no manual PHPCS path configuration needed.
Run PHPCS with the HaptiqWordPress standard:
vendor/bin/phpcs --standard=HaptiqWordPress .Or copy the provided phpcs.xml.dist to your project root as phpcs.xml and run:
vendor/bin/phpcsIf phpcs.xml configures the use of HaptiqWordPress, run:
vendor/bin/phpcs| Rule group | Default severity | What it covers |
|---|---|---|
WordPress-Core |
warning | WordPress coding style and conventions |
WordPress-Extra |
warning | Stricter WordPress best practices |
PHPCompatibilityWP |
warning | PHP and WP API version compatibility |
All violations are warnings by default — they are reported but do not block CI. See Adjusting severity to promote specific groups to errors.
Targets: PHP 7.4–8.4 · WordPress 6.8+
To promote a rule group to an error in your project's phpcs.xml:
<rule ref="HaptiqWordPress/WordPress-Core">
<type>error</type>
</rule><rule ref="HaptiqWordPress">
<exclude name="WordPress.Files.FileName"/>
</rule>WordPress-Docs is available but not included by default. Add it to your phpcs.xml:
<rule ref="WordPress-Docs"/>