wpcompatibility / wp-compatibility
WPCompatibility has a collection of PHPCS sniffs which will tell you if your plugin/theme code is compatible with a specific wordpress version
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:phpcodesniffer-standard
Requires
- php: >=5.4
- ext-json: *
- phpcsstandards/phpcsextra: ^1.0
- phpcsstandards/phpcsutils: ^1.0
- squizlabs/php_codesniffer: ^3.0
Requires (Dev)
- phpunit/phpunit: ^4.0 || ^5.0 || ^6.0 || ^7.0
This package is auto-updated.
Last update: 2025-03-04 03:30:58 UTC
README
wpcompatibility
is a collection of PHP_CodeSniffer (PHPCS) sniffs designed to check if your WordPress plugin/theme code is compatible with specific WordPress versions.
Table of Contents
Installation:
composer require wpcompatibility/wp-compatibility
Usage:
Command
# For single wp version WP_COMPAT_PHPCS_SUPPORTED_VERSIONS='5.0.0' vendor/bin/phpcs --standard=WPCompatibility your-plugin-or-theme-folder/ # To test against multiple wp versions you can separate versions by comma WP_COMPAT_PHPCS_SUPPORTED_VERSIONS='5.0.1,6.0' vendor/bin/phpcs --standard=WPCompatibility your-plugin-or-theme-folder/
Ruleset File
<rule ref="WPCompatibility.Signature.Function"> <properties> <property name="versions" value="4.3,6.1" /> </properties> </rule>
Functions
- Detect if a wordpress function is present in specific version. For example if you have a plugin file with the below code which is set to be compatible with 5.0, this will throw an error
<?php wp_date(); ?>
Function: wp_date is not available in wordpress version 5.0.0
- Verify wordpress function signature, if you pass less number of arguments to a wordpress function then it will raise an error.