WordPress
Theme and plugin development standards following WordPress coding conventions.
Formatting & Naming
- Follow WordPress PHP coding standards (tabs for indentation)
- Use snake_case for function names:
get_custom_post_data() - Prefix all functions, classes, and globals with unique identifier
- Use descriptive hook names:
my_plugin_before_content_display - Follow WordPress file naming conventions
Hooks & Functions
- Use proper WordPress hooks instead of direct file modifications
- Sanitize and validate all user input
- Escape output data with appropriate functions:
esc_html(),esc_attr() - Use WordPress functions over PHP equivalents when available
- Check user capabilities before executing admin functions
Best Practices & Tools
- Use WordPress coding standards with PHPCS
- Follow the WordPress Plugin/Theme directory guidelines
- Implement proper nonce verification for forms
- Use WordPress transients for caching
- Test with WordPress debug mode enabled