Recently one of our readers sent us an email asking various questions clarifying how different components of a WordPress site works. His intention was to migrate his Weebly site to self-hosted WordPress platform and he was trying to understand the concepts before migration. WordPress is an easy content management system for those using for years but definitely not for those using Weebly, Wix or any other drag and drop site builders. The major difference is that the objective of the free site builders is to offer an easy to use platform without the need of understanding the backend concepts. In contrary, it is not possible to use WordPress without understanding the basics. In this article we will focus on the basic principles of how WordPress works in simple words.
How Does WordPress Work?
WordPress has the following four components interact with each other in order to create a HTML page.
- Core files
- Theme files
- Plugin files
You can easily understand these components by manually installing WordPress on a test site or temporary domain. Basically you need to download the core WordPress files from WordPress.org site and create a MySQL database for installing WordPress. Then install a theme and required plugins to achieve the required features and display functions.
WordPress Core Files
These are the files part of the WordPress installation package downloaded from WordPress.org. Since WordPress is a free and open source you can download the package to see the core files as shown below:
During the installation the content of these core files will be dynamically changed as per the need. For example, there will be a new “wp-config.php” file created with the databased username, password and other configuration parameters.
Core, theme and database files are mandatory while plugins are optional to add additional features to your WordPress site. As WordPress has bifurcation between theme and plugins it is almost unavoidable to have plugins to add functions. For example, social sharing is not part of theme definition and hence you need separate plugin to have good looking social sharing icons on your site. Files of all installed plugins will be stored under the core folder “/wp-admin/plugins/” and each plugin will be stored under separate folder. Each plugin may have set of PHP, script and CSS files. The WordPress core download package will have two default plugins Akismet and Hello Dolly. The plugin “Hello Dolly” has only one “hello.php” file:
While Akismet has many files as shown below:
Database is the most important component of your WordPress site which has all the content and controlling parameters. Whenever a page is requested the content is retrieved based on the controlling parameters and the desired output is displayed on the browser. For example, when you create a blog post – all of its text content is stored in database tables with reference to the images and videos linked on that page.
WordPress uses MYSQL an open source tool for database creation. The database of your WordPress installation can be maintained through the hosting account using “MySQL Database” and “phpMyAdmin” tools. It is important to understand that database tables can’t be managed through FTP while core, theme and plugin files can be accessed through FTP.
Note: Also all the media files like images, PDFs and videos are stored under WordPress core folder “/wp-content/uploads/”.
All four components interact with each other heavily to generate the content for the requested URL in desired format.
The page load time depends on number of queries send to database and the response time from the server. Hence, depends on the size of your site good hosting and less number of queries will increase the loading speed. Also use of caching plugins reduces the need of interacting with these components every time by storing a static HTML copy of the page.
In contrary to free site builders where you get completely free hosting, WordPress needs a paid hosting to store all files and database. A good website needs to run on a good platform like WordPress without much restrictions on backup and functionalities. This is only possible with paid hosting and you have complete access to the files of your site. With the free site builder tools like Weebly or Wix, you will not be able to access and control server’s behavior.
Advantages of Using Different Components
There are many advantages of keeping the four components separately which is also one of the reasons for the huge success of WordPress.
- It is easy to add or remove additional functions through plugins without impacting the whole site.
- You can change the theme thus changing the design and look of your complete site.
- Easily migrate all files and database to different host based on your need.
- Updating WordPress files to next version will not affect your site’s database and other files.
Hope you have got an idea of how does WordPress work. If you have any clarifications, check out the official WordPress documentation for more details.