Development · Backend (PHP)
Backend (PHP)
WordPress was built on PHP from the start — and PHP remains the foundation of every request, even as the stack adds blocks, JavaScript, REST, and headless frontends.
PHP as the foundation of WordPress development
WordPress began in 2003 as open-source blogging software written in PHP. Twenty years later the ecosystem looks different — block themes, the Site Editor, React in the admin, REST and GraphQL APIs, decoupled Next.js frontends — but the server still boots through PHP on every page load, cron job, WP-CLI command, and authenticated REST request.
That does not mean WordPress is “PHP only.” Modern projects combine PHP with JavaScript, CSS, SQL, and external services. It means business logic, security boundaries, and data access still live primarily in PHP — in core, in your plugins, and in theme functions.php files. If you understand PHP in a WordPress context, you understand how the platform actually executes your code.
What still runs in PHP today
- Core bootstrap —
wp-load.php,wp-settings.php, loading must-use plugins, active plugins, and the theme. - Plugins and themes — registration hooks, admin screens, custom post types, taxonomies, and service classes.
- Blocks on the server —
block.json, dynamic render callbacks, block patterns registered from PHP, and server-side block supports. - REST API — route registration,
permission_callback, argument schemas, and response shaping. - Admin & AJAX — list tables, settings pages, meta boxes, and
admin-ajax.phphandlers. - Data layer —
$wpdb, Options API, meta APIs, transients, and custom tables viadbDelta(). - Background work — WP-Cron events, Action Scheduler jobs, and WP-CLI scripts.
JavaScript owns interactivity in the editor and on the front end; PHP owns what WordPress stores, who may access it, and how it is rendered on the server. Production 4WP plugins follow that split: React blocks and inspector UI on the client; PHP services, repositories, and REST controllers on the server.
Why PHP skills still matter for WordPress developers
- Extension model — WordPress extends through hooks (
add_action,add_filter), and those are PHP functions. - Security — capability checks, nonces, sanitization, escaping, and prepared SQL statements are implemented in PHP.
- Integrations — payment gateways, CRMs, OAuth, webhooks, and email delivery are typically wired in PHP classes or procedural bootstrap files.
- Performance — query design, autoloaded options, object cache usage, and lazy loading are backend concerns.
- Maintainability — WordPress Coding Standards (WPCS), namespaces, and OOP patterns keep large plugins readable across teams.
Headless and API-first setups do not remove PHP — they move the HTML theme elsewhere while WordPress continues to authenticate users, enforce capabilities, run queries, and expose content through PHP-registered endpoints.
Modern PHP in WordPress projects
WordPress supports a wide range of PHP versions depending on hosting; production sites should run a supported, actively maintained PHP release for security and performance. In plugin code you will encounter:
- Procedural bootstrap files and hook callbacks — still common and valid.
- Namespaced classes with autoloading (Composer PSR-4) — standard in larger plugins and Bedrock-style stacks.
- Type hints and return types — increasingly used in modern WordPress and 4WP codebases.
- WordPress APIs over raw PHP — prefer
WP_Query, Options API, and transients instead of reinventing storage.
Backend topics on 4WP.dev
Start with the guides below — each goes deeper into a slice of WordPress backend development:
- Hooks — actions and filters, the primary extension mechanism.
- Functions — core PHP APIs for posts, users, options, and utilities.
- Database — schema,
$wpdb, custom tables, queries, and meta. - WordPress Coding Standards — PHPCS and WPCS for review-ready code.
- REST API — custom routes and permission callbacks (PHP on the server).
For system structure and OOP patterns see Architectures; for process (SDD, DDD, TDD) see Methodologies.