Documenting WordPress Architecture

‘” used WordPress as a Content Management System (CMS). It is a great software with a many contributors which provide lots of functionality to make website-building easier. At the same time, the large community of contributors with a variety of backgrounds also means lots of confusing documentation and lack of understanding of what it is. So, for my first post, I’ll document WordPress architecture as a way to help clarify what it is and how it works.

  1. Overview – What is WordPress?
  2. Design – How does it works?
  3. Maintenance – Creating/Updating contents
  4. Closing Note

1. Overview – What is wordpress?

The abstracted definition is a piece of software that help you create great website. But looking beyond this definition, WordPress (WP) is composed of 3 main components:

  • WP_Core – A library of functions that define the content of the website and ways to manage (store, modify, retrieve) it.
  • WP_Admin – A web-based General User Interface (GUI), mainly for creating new content (posts/pages) for the site
  • WP_Theme – A structure to manage “what” to display on the website and  “how” does it look

2. Design – How does it works?

To simplify how WordPress works and make it easier to grasp, we start with a HTTP request and see how WordPress returns the requested content. This journey should allow us to uncover how WP_Core being initialized and WP_Theme is used to display the web content.

<< figure 1 - HTTP request for content>>
Figure 1 – HTTP request for content

WP_Theme is a structure of .php files that handle different “webpages”. Here, WordPress has defined “webpage” into many types. A page could be: a single post page, an archive (category) page, a single page, a home-page/index-page/front-page, and more. These pages could look different and contain different content, so they all could have a unique .php file to define what to be display. Architecturally, these files are landing files for when a HTTP request matched one of these pages. For example, say for my project page (, the directory “/projects” are internally known as a category page so the category.php from my theme is used to display some content. And for this page (, wp_query determined this is a single post page, so the single.php from my theme is used to display its content. More information about how the WP_Theme is used to display different content can be found in the Template Hierarchy.

3. Maintenance – Creating/Updating contents

How are the contents typed? The content-creator manage that part. When a post or a page is created with WP_Admin, they can be specialized by using categories, tags and slugs. These specialization provide a naming scheme that later matched to the corresponding .php files from the WP_Theme. A post can be characterized by category (e.g., projects, ideas, blog, traveling, etc.) and tags (e.g., documentation, personal, work-related, art, etc.). A page can be characterized by its page title (the default slug) or a user-defined slug. Slugs can be think of as file extension — or page extension in this case. The complete varieties of pages are shown here and post types are documented here.

4. Closing Note

This documentation is based on the inspection of WordPress 4.1. The architecture details may be relevant in future versions but I can’t be certain that all the inner components of WordPress remain to work as described.