A tongue-in-cheek look at coding standards in the WordPress core and the average WordPress plugin.
- # Declare variables
global
- in case they're going to be used again - All function/method parameters should be strings (e.g.
'yes'
/'no'
) - for clarity - Functions and methods should return mixed types
- No need to separate PHP logic from HTML, JS or CSS
- Don't worry about PHP Notices - they're not important
- Keep compatibility with PHP 4 - it's still used
- If writing a class, create a non-OO function (that calls the class) for every method
- Combine multiple classes and functions in a single file - for performance
- Functions should
echo
instead of returning - to save having to echo later on - Assume input has already been filtered through
add_slashes
- WordPress is pre-secured