Topics
- PHP
- Single and Double Quotes
- Indentation
- Brace Style
- Use
elseif, notelse if - Regular Expressions
- No Shorthand PHP Tags
- Remove Trailing Spaces
- Space Usage
- Formatting SQL statements
- Database Queries
- Naming Conventions
- Self-Explanatory Flag Values for Function Arguments
- Interpolation for Naming Dynamic Hooks
- Ternary Operator
- Yoda Conditions
- Clever Code
- Error Control Operator
@ - Don’t
extract()
- Credits
Some parts of the WordPress code structure for PHP markup are inconsistent in their style. WordPress is working to gradually improve this by helping users maintain a consistent style so the code can become clean and easy to read at a glance.
Keep the following points in mind when writing PHP code for WordPress, whether for core programming code, plugins, or themes. The guidelines are similar to Pear standards in many ways, but differ in some key respects.