WordPress for developers: how it fits together

See WordPress as a PHP application made of core, themes, plugins, a database and the block editor.

  • Intermediate
  • 6 min read
  • Updated 17 Oct 2026

What you will learn

  • Name the main parts of WordPress
  • Know where custom code goes
  • Explain why you never edit core files

Before you start

To an editor, WordPress is a dashboard for writing pages. To a developer, it is a PHP application with a database, a templating system and a large set of APIs you can extend without touching its own code. This lesson gives you the map you will use for the rest of the course.

You already know PHP from PHP for Beginners. WordPress is written in the same PHP: functions, arrays, include and require. What is new is the structure around it and the rules for where your code lives.

The five parts

Every WordPress site is made of the same pieces:

PartWhat it isWho changes it
CoreThe PHP files that ship with WordPress: routing, users, posts, the admin screens, the APIsThe WordPress project, through updates
DatabaseA MySQL or MariaDB database holding posts, users, settings and metadataWordPress and your code, through APIs
ThemesControl how the site looks: templates, styles, layoutYou or a theme author
PluginsAdd or change behaviour: post types, integrations, forms, REST endpointsYou or a plugin author
The block editorThe JavaScript editing interface, also called Gutenberg, used for content and, in block themes, for whole site layoutsWordPress core, extended by blocks

On top of these sits the content itself: posts, pages, media and users, all stored in the database.

Core: the part you never edit

Core is everything in the wp-admin and wp-includes folders plus the PHP files in the site root. It loads the configuration, connects to the database, works out which content the visitor asked for, and hands over to the theme to render it.

You will read core code often. It is the best documentation of how a function really behaves. But you never change it. Every update replaces those files, so any edit is lost, and a modified core is a security and support problem.

If a tutorial tells you to edit a file in wp-includes or wp-admin, find another way. WordPress almost always offers a hook or an API for the change you want.

Hooks: how you change core without editing it

Core is full of named points where it pauses and lets other code run. These are hooks. There are two kinds:

  • Actions let you run code at a moment, such as "WordPress has finished loading" or "a post was saved".
  • Filters let you change a value before WordPress uses it, such as the title of a post or the text of an email.

Themes and plugins attach their own functions to these hooks. This is the single most important idea in WordPress development, and you will learn it properly in the hooks lessons. For now, remember that nearly all custom code is a function attached to a hook.

Themes: presentation

A theme decides what visitors see. There are two styles of theme in use today:

  • Classic themes use PHP template files such as index.php, single.php and archive.php, plus a functions.php file.
  • Block themes use HTML template files made of blocks, a theme.json file for settings and styles, and the Site Editor so users can change layouts visually.

Both styles still use the same core underneath. A separate Block Theme Development course covers block themes in depth. This course focuses on the PHP layer that all themes share.

Plugins: behaviour

A plugin is a folder in wp-content/plugins with at least one PHP file that has a header comment. Plugins add features: custom content types, settings screens, integrations with other services, REST API endpoints, scheduled tasks.

The rule of thumb is simple. If a feature should keep working after the site changes its theme, it belongs in a plugin. The lesson on themes versus plugins covers this decision in detail.

The database

WordPress stores almost everything in a handful of tables:

  • Posts hold posts, pages, attachments, menu items and any custom content type.
  • Post meta holds extra fields for each post.
  • Terms and taxonomies hold categories, tags and your own groupings.
  • Users and user meta hold accounts and their settings.
  • Options hold site-wide settings.

You rarely write SQL. WordPress gives you functions such as get_posts(), get_post_meta() and get_option() that read and write these tables safely and use caching.

The block editor

The block editor is a JavaScript application, built with React, that talks to WordPress through the REST API. Editors build content from blocks such as paragraphs, images and columns. When a post is saved, the blocks are stored as HTML with comment markers inside the post content.

As a PHP developer you meet the editor in three places: registering post types that appear in it, exposing data through the REST API, and registering blocks. Building custom blocks is covered in the Custom Gutenberg Block Development course.

Where your code goes

Here is the map you will use when deciding where something belongs:

You want toPut it in
Change colours, layout or templatesThe theme (or a child theme)
Add a content type, shortcode, REST endpoint or integrationA plugin
Force code to run on every request, for example on a client site that must not be switched offA must-use plugin in wp-content/mu-plugins
Change database, debug or environment settingswp-config.php
Change how core behavesA hook, from a plugin or theme

Prefix everything you write. WordPress runs every plugin and theme in the same PHP process, so a function called get_books() will collide with somebody else's. This course uses myplugin_ and mytheme_ as prefixes.

The project you will build

Through this course you will build a small plugin for an events site. It registers its own content types and taxonomies, queries them efficiently, exposes them through custom REST endpoints, protects every form and request, and caches expensive work. Each lesson adds one piece.

Summary

  • WordPress is a PHP application: core, a database, themes, plugins and the block editor.
  • Never edit core. Change its behaviour through hooks.
  • Actions run code at a moment; filters change a value.
  • Themes handle presentation; plugins handle behaviour that must survive a theme change.
  • Read and write data through WordPress functions rather than raw SQL.
  • Prefix every function, hook and option you create.

In the next lesson you will set up a local WordPress site to work on.

Further reading