WordPress-Coding-Standards icon indicating copy to clipboard operation
WordPress-Coding-Standards copied to clipboard

PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions

Results 220 WordPress-Coding-Standards issues
Sort by recently updated
recently updated
newest added

> When formatting SQL statements you may break it into several lines and indent if it is sufficiently complex to warrant it. Most statements work well as one line though....

Type: Enhancement
Component: Core
Focus: DB

According to [WordPress documentation](https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/#since-section-changelogs), every function, hook, class, and method should have a corresponding `@since` version associated with it. How I can get that sniff?

Type: Enhancement
Component: Docs

## Bug Description When I replace ```php _doing_it_wrong( __FUNCTION__, 'My message', '1.0.0' ); ``` with ```php const MY_MESSAGE = 'My message'; _doing_it_wrong( __FUNCTION__, MY_MESSAGE, '1.0.0' ); ``` I get a...

Status: Invalid
Type: Question
Status: Awaiting Feedback

### Current situation The WordPress Coding Standards currently enforce file names to: 1. Be all lowercase; 2. Use hyphens instead of underscores as word separators; 3. Have a `class-` prefix...

Component: Core
Priority: High

Worth adding a directory of exports from IDEs, with instructions on how to import them, so that the code formatted by IDEs at least start off as close to WP...

I'd like to consider what sniffs could be written that address programatically testable accessibility concerns. The first is to check for the use of the `title` attribute, and flag it...

Type: Enhancement

## Bug Description `ClassName::class` is safe for use and doesn't need escaping. ## Minimal Code Snippet ```php function foo() { _deprecated_function( __METHOD__, 'x.x.x', ClassName::class ); } ``` ## Error Code...

Type: Bug
Focus: Modern PHP

PHPCS 3.1, WPCS 0.13.0, PHP 5.6.30 A backslash used to indicate the global namespace prevents customAutoEscapedFunctions from being recognized. I have a ruleset like this: ``` ``` And some code...

Type: Enhancement
Focus: Security

## Describe the solution you'd like Sometimes difficult to determine logic bugs occur when `switch_to_blog()` is called without a subsequent restoration. It would be worth flagging to the user that...

Type: Enhancement

## Bug Description When all that's done with a superglobal value is to _unset_ it, no nonceverification should be necessary. Currently, the sniff will throw a warning for this: ```...

Type: Bug