Wp Phpcs Coding Standards

Set up and run PHP_CodeSniffer with the WordPress Coding Standards (WPCS) and PHPCompatibility on a plugin or theme. Covers the composer dev-dependencies and their exact (and confusingly-named) packages — `squizlabs/php_codesniffer`, `wp-coding-standards/wpcs`, `phpcompatibility/phpcompatibility-wp`, `dealerdirect/phpcodesniffer-composer-installer` — the required `allow-plugins` config, the `phpcs.xml.dist` ruleset (the `WordPress` / `-Core` / `-Extra` / `-Docs` standards, `prefixes`, `text_domain`, `minimum_wp_version`, `testVersion`), running `phpcs` (check) vs `phpcbf` (auto-fix), `phpcs -i`, `phpcs:ignore` / `disable` comments, and the WPCS 3.x breaking changes (sniff and property renames such as `minimum_supported_version` becoming `minimum_wp_version`). Use when adding coding-standards linting, writing/auditing a ruleset, or fixing "standard not installed" / WPCS 2.x-to-3.x migration problems.

Lonsdale201 Updated

File contents

Lonsdale201/wp-agent-skills/tree/main/dev-tooling/wp-phpcs-coding-standards commit 7c959699b1

Frequently asked questions

npx skillmds@latest add lonsdale201/wp-phpcs-coding-standards