First released in 2003, WordPress is a free and open-source content management system (CMS) written in a coding language called PHP and runs on a MySQL database. [source Wikipedia].
Woah! Wait a minute! What the heck does all that gibberish even mean?
I’m going to explain how WordPress works as best I can without having your head explode. What I’m about to write is terribly simplified. My goal here is not to educate you to the point of becoming a programming genius, but to offer enough information that you can better understand how a WordPress page is actually created and displayed.
First and foremost you must understand one thing: a WordPress website is not a regular website with hand-coded HTML pages stored in folders or directories. Gone are the days when you needed to hand-code every page on your website individually and then save/store those pages on your web server – waiting for someone to visit them on the Internet.
Nope. WordPress is written in a coding language called PHP, and all of the pages and content on a WordPress are dynamically created in the instant they are viewed in a web browser.
When you visit a WordPress website, the page you’d like to see doesn’t actually exist until you (via a web browser) make a request to view it. At that point, the WordPress application builds the page on the fly and sends it to the browser to be displayed. But how does it all actually work?
WordPress is a Web-Based Content Management System
A WordPress website is built, managed and viewed primarily via a web browser. Additionally, all of the content that is created, uploaded, edited and managed is also done so through a web browser.
Your Website’s Content and Settings Are Stored in a MySQL Database
One of the things that makes WordPress a content management system (CMS) is the fact that all of its content and settings are stored in a database. WordPress uses a MySQL database. MySQL (pronounced My Sequel) is the language used to store and retrieve the data inside the database, and WordPress stores and grabs that data using PHP code and MySQL queries.
When you install WordPress for the first time, a database is created with multiple tables for storing the website’s data. Each table inside the database is programmed to store specific types of data. The PHP code within WordPress is programmed to grab the specific data and settings from the website in general and pages/posts specifically and send it to the database. Comments, categories, posts and pages, as well as user information, passwords, your time zone, the website’s name and URL etc. are all stored in various tables of the MySQL database. When someone visits a page, that data is retrieved by WordPress via MySQL queries.
The WordPress Application Files Are Stored On Your Web Server
Before you installed WordPress on your domain’s web server, you were required to purchase web hosting from a web host provider (along with a domain name). A web server is basically a remote computer you rent space on to park your website. It is on that web server that all the WordPress files (and the MySQL database) are stored.
The three main folders where the WordPress Application is stored are named wp-admin, wp-content and wp-includes. The wp-admin folder contains the files and code that run the administrative backend of your WordPress website.
The wp-includes folder contains the WordPress core files that does most of the work of actually making the entire application function properly.
The wp-content folder contains mostly user-defined code and content like images and videos files you upload to the media library, as well as plugins and themes you install. There are other WordPress files stored outside of these three folders, the most important being the wp-config file. But the three folders mentioned here contain the bulk of the WordPress application. Suffice it to say: DO NOT EDIT THE CODE ON ANY OF THESE FILES UNLESS YOU KNOW EXACTLY WHAT YOU’RE DOING!!
How Does It All Work?
When you create a new page or post on your website and hit the “publish” button, you not only make the page viewable by anyone on the web, but the actual content of that page and its settings are saved to the MySQL database. Any media files you uploaded to the page are stored in the
Nothing else happens until someone visits your website via a web browser. When that browser (on a computer or mobile device) lands on the page, a request is made by the browser to the WordPress application to display the page. THAT’S when all the action happens.
The pages doesn’t actually exist. WordPress must build the page on the fly using the content stored in the database, any media files stored in the
wp-contents folder, and page templates that determine the structure and design of a page. These page templates are also known as a WordPress theme.
The specific data grabbed from the database is plugged into the appropriate places of the various template files of the theme. All of the PHP is translated into HTML, and the page is sent to the browser to be viewed.
A browser cannot read PHP. Only web servers can. So the WordPress application must translate all of the PHP into HTML so the web browser can then translate that code into a formatted webpage that is human readable.
HTML defines the structure of the page. CSS defines the design and “look and feel” of the page.
The mind-blowing part is that every piece of data that makes up every page on your site is pretty much rendered the same way, and WordPress is able to do this in a blink of a eye and with multiple visitors to a website at one time! Awesome.
There is so much more information when it comes to how WordPress actually works. The goal here was to provide an accurate, yet greatly simplified overview as to HOW WordPress Works.