wp-guidelines
Installation
SKILL.md
WordPress Coding Standards & Conventions
Quick-reference for WordPress PHP development. Rules are distilled from the official WordPress Coding Standards (WPCS) sniffs and WordPress core documentation.
1. Naming Conventions
All names use snake_case for functions, variables, and properties. Classes use Pascal_Case with underscores (My_Plugin_Admin). Hook names are all-lowercase with underscores, prefixed with your plugin slug.
| Element | Convention | Example |
|---|---|---|
| Functions | snake_case |
acme_get_settings() |
| Variables | snake_case |
$post_title |
| Classes | Pascal_Case (underscored) |
Acme_Plugin_Admin |
| Constants | UPPER_SNAKE_CASE |
ACME_VERSION |
| Files | lowercase-hyphens |
class-acme-admin.php |
| Hook names | lowercase_underscores |
acme_after_init |
| Post type slugs | lowercase, a-z0-9_-, max 20 chars |
acme_book |