WordPress runs on PHP 8. Most WordPress code is still written for PHP 5.6.
A 2,000-line functions.php, a Singleton in every class, vendor/ that clashes with another plugin and a closure on a hook nobody can remove. It works until the first PHP update or the first code review.
This course is modern PHP in the WordPress context: types, classes, namespaces, Composer, error handling and plugin architecture. And the places where WordPress sets its own rules: callbacks for hooks, WP_Error instead of exceptions, vendor/ conflicts between plugins.
Course path
flowchart TD
START(["Today: functions.php and PHP 5.6 habits"])
subgraph S1["Stage 1 · Language"]
direction TB
M1["1. PHP Runtime in WordPress<br/>PHP-FPM · OPcache · debug"]
M2["2. Modern PHP Syntax<br/>types · match · enum · readonly"]
M3["3. Callables, Closures and Hooks<br/>callable · closure · remove_action"]
M1 --> M2 --> M3
end
subgraph S2["Stage 2 · Architecture"]
direction TB
M4["4. OOP for WordPress<br/>interfaces · traits · DI"]
M5["5. Namespaces, Autoloading and Composer<br/>PSR-4 · vendor · prefixing"]
M6["6. Errors, Exceptions and WP_Error<br/>Throwable · WP_Error · logging"]
M4 --> M5 --> M6
end
subgraph S3["Stage 3 · Production code"]
direction TB
M7["7. Working with Data<br/>arrays · JSON · serialization · dates"]
M8["8. Plugin Architecture Patterns<br/>MVC · layers · container · DTO"]
M9["9. Interview Prep<br/>questions · live coding · code review"]
M7 --> M8 --> M9
end
FINISH(["Result: modern, typed, testable PHP in WordPress"])
START --> M1
M3 --> M4
M6 --> M7
M9 --> FINISH
What you'll be able to do after each module
- PHP Runtime: the same code behaves the same on every host. You know the path request → PHP-FPM → OPcache →
wp-load.phpand debug withWP_DEBUG, logs and Xdebug. - Modern syntax: PHP 8 without breaking old sites. Types,
match,enum,readonly, and what is safe for a WordPress.org plugin. - Callables and hooks: every callback can be found and removed. You pick the right callable for
add_action()and know why a closure cannot be unhooked. - OOP: classes without tutorial anti-patterns. Interfaces, composition and dependency injection instead of a Singleton everywhere.
- Composer: your
vendor/never clashes with another plugin. Namespaces, PSR-4 autoloading and prefixing. - Errors: failures are handled, not white screens. Exceptions and
WP_Erroreach in their place, plus logging. - Data: arrays, JSON and dates without surprises. Serialized data that survives search-replace and time zones that stay right.
- Architecture: a 2,000-line file becomes a testable structure. MVC, layers, a container, repositories and DTOs on real plugin code.
- Interview: ready for the middle PHP interview. Typical questions, live coding and code review.
How a lesson works
| Part | What you get |
|---|---|
| Short theory | only what you need for practice |
| Code | examples from real plugins |
| Common mistakes | symptom → cause → fix |
| WPCS note | the WordPress Coding Standards rule for the topic |
| Terminal / IDE practice | runs right in the browser, nothing to install |
| Interview questions | ready answers to the questions interviewers ask |
Who it's for: junior+ and middle WordPress developers who learned PHP from tutorials and want to write modern code.
Result: modern, typed PHP in your plugins: classes and interfaces, Composer with prefixing, proper error handling and an architecture you can test and defend in a code review.
Outside this course
- WP Core (hooks lifecycle, WP_Query, CPT) → WP Core
- Plugin and theme structure, activation and uninstall → Plugin & Theme Development
- PHPUnit, PHPStan, full WPCS and PHPCS setup → QA / Tests