Ever wondering how WordPress actually works behind the scenes? Most of the users today thinks that it is simple because all you have to do is type a URL as well as page loads in just a few seconds. However, there are actually lots of work behind the scenes. This guide will show you through infographics how the WordPress team actually works behind the scene.
- Load theWp-config.php File
It is the WordPress configuration file. This file sets global variables for WordPresssites, it also contains the WordPress data info. For a very obvious reason, this is the first file that WordPress loads.
- Set-up default constants
After the load of wp-config.php file, WordPress will then move to set the default constants. Default constants includes all the information needed such as the default upload location, maximum file sizes as well as other default constant sets.
- Load the advanced-cache.php file
Once the advanced-cache.php file already exists on your website, then WordPress will load it next. Advanced-cache-.php file is a file that acts like a drop-in file. It is used by a number of popular WordPress plugins. If your website is suing this type of file, you will then notice a new item on plugins display called Drop-ins.
- Load the wp-content/db.php file
WordPress allow developers to make or create their own database attraction layer as well as load them in a db.php file. These files are placed inside the wp-content folder.
- Connect the MySQL. Select Database
After WordPress had enough info it needs to proceed further, it will now move or connect to the MySQL server. It will also select the database, however, if WordPress isn’t able to connect to the database, you will see the sign “establishing database connection” the error sign. From this point, WordPress will now quit. If everything worked fine, then WordPress will now move on to the next set of steps.
- Load the object-cache.php or the wp-includes/cache.php file
- Load the wp-content/sunrise.php file.
- Load the Localization library.
- Load the Multiple Plugins.
- “muplugins_loaded” do action
This action is only available to those network activated plugins on WordPress multisite.
- Load the Active Plugins
- Load the pluggable.php file
This file contains all the functions WordPress plugins can be redefined. If WordPress cannot see the files inside that are already defined by another plugin, then it will define those functions itself.
- “plugins_loaded” do action
- Load the rewrite rules
- $wp_query, $wp_rewrite, $wp
WordPress will now load the 3 following objects:
$wp_query – it holds the WP_Query class and tells WordPress the contents requester in a usual WP query format.
$wp_rewrite – another global instance which holds the WP_Rewrite class. This file contains the rewrite rules and functions.
$wp – it contains the function which will parse the request and performs the main query.
- “set_up theme”
This action typically runs before the WordPres theme is actually loaded.
- Load the child theme’s functions.php file
- Load the parent theme’s functions.php file
After WordPress has already set-up the theme and all the theme functions, it will now action the “after_setup_theme”.
- Set-up the Current User Object
- “init” action
“init” action allows the developer to add codes they needed to execute after WordPress has already loaded all information needed.
- “widget_init” do action
- Run the wp()
It is located in the wp-includes/functions.php file
- Request parse
- Run Query
- Do the action “template_redirect”
- Load the Feed Template.
- Then Load Template
- “Shutdown” action
The last action is called the shutdown. At this point, the WordPress will now stop working since it already ran the code and the generated user’s requested webpage.
That’s it. That is how WordPress actually works behind the scene. And what is more amazing is that all of these things actually happen within milliseconds.
We hope that this article will help you a lot in learning how WordPress works behind the scenes. If you have comments, suggestions or ideas, please write in the comment box below.