How WordPress really works Behind the Scenes (Infographic)

maybe you have wondered exactly how WordPress is proven to work behind the scenes? For some users, this indicates easy because you type a Address plus web page lots in few seconds, but there is a great deal that happens behind the scenes. Inside guide, we will walk you through exactly how WordPress really works behind the scenes, and now we have developed a straightforward to follow along with infographic aswell.

How WordPress Functions Behind the Scenes

Why You Should Understand How WordPress Works?

WordPress can be an available source software, which means any one can learn its rule and write their very own apps (plugins) and templates (themes) because of it.

Learning just how WordPress works and how are you affected behind the scenes can help you know very well what you are able to do with it. You are able to learn about increasing WordPress performance and write better rule for your own tasks.

This guide will walk you through the entire procedure detail by detail. We will begin with when a individual requests a full page and end whenever that web page is fully loaded.

Prepared? Let’s get going.

Simply click to see the Behind the Scenes WordPress Infographic

You’ll be able to follow our written tutorial below for lots more details.

1. Load wp-config.php File

The wp-config.php could be the WordPress setup file. It sets worldwide factors for the WordPress website possesses your WordPress database information. This is actually the first file WordPress lots for obvious reasons. Find out more about wp-config.php file and exactly how to modify it.

2. Setup Standard Constants

After loading wp-config.php file, WordPress will proceed to set default constants. This consists of information like default WordPress upload location, maximum file sizes, along with other default constants set in wp-config.php file.

3. Load advanced-cache.php File

If advanced-cache.php file exists on your own site, then WordPress will load it next. This file will act as a drop-in file and it is employed by several popular plugins particularly WordPress caching plugins. In case the website is by using this file, then you’ll definitely view a new product regarding plugins screen called Drop-ins.

advanced-cache.php file showing up as drop-in

4. Load wp-content/db.php File

WordPress enables designers to create their own database abstraction levels and load them in a db.php file placed within the wp-content folder. It’s popular by WordPress caching plugins to improve database performance. If the website has this file present, then WordPress will load it.

5. Connect MySQL and choose Database

WordPress are in possession of sufficient information to proceed further. It’s going to proceed to connect to the MySQL server and select the database.

If WordPress struggles to connect to the database, then you will start to see the “Error establishing database connection” error and WordPress will quit right here.

If everything works fine, then it’ll move on to next actions.

6. Load object-cache.php or wp-includes/cache.php File

WordPress will now try to find object-cache.php file. If it cann’t occur, then WordPress will move on to load wp-includes/cache.php file.

7. Load wp-content/sunrise.php File

If it is a multisite system, then WordPress will now search for sunrise.php file if it exists in wp-content folder.

8. Load Localization Library

WordPress will now load l10n.php library in wp-includes folder. This file loads WordPress localization system, lots translations, sets locales, etc. See our guide on how to utilize WordPress in other languages.

9. Load Multisite Plugins

In case it is a multisite community, then WordPress will now load the multisite plugins. Find out about just how plugins work on WordPress multisite community.

system activated plugins

10. Do Action ‘muplugins_loaded’

The action muplugins_loaded has become run by WordPress. This step can be obtained only to network triggered plugins for a WordPress multisite.

11. Load Active Plugins

WordPress will now load all active plugins on the internet site. It can that by looking inside active_plugins entry within the choices dining table of one’s WordPress database. This allows WordPress to ignore plugins which are set up on your website although not triggered.

12. Load pluggable.php File

The pluggable.php file contains functions that may be redefined by WordPress plugins. WordPress will now see if the functions inside this file are already defined by another plugin. Otherwise, it will define those functions itself.

13. Do Action ‘plugins_loaded’

WordPress will now run the action ‘plugins_loaded’. It allows developers to hook their functions to run in the end active plugins have been loaded.

14. Load Rewrite Rules

WordPress will now load the rewrite guidelines. These rewrite rules help WordPress use Search Engine Optimization friendly URLs.

15. Instantiate $wp_query, $wp_rewrite, $wp

At this time WordPress loads these objects:

$wp_query: The international example that holds WP_Query class. It tells WordPress what content is requested in an average WordPress question format.

$wp_rewrite: The global example that holds your WP_Rewrite class. It includes your rewrite guidelines and functions which tell WordPress which Address to make use of to display the requested content.

$wp: The worldwide instance for the WP course containing functions which will parse your demand and perform the key question.

16. Do Action ‘setup_theme’

WordPress will now proceed to run ‘setup_theme’ action. This step runs before your WordPress theme is loaded.

17. Load Child Theme’s functions.php File

The functions.php file acts as plugin and is utilized in WordPress themes to include theme specific features to your site. If you use a child theme, then WordPress will now load your youngster theme’s functions.php file.

Otherwise, it will just load your active theme’s functions.php file.

18. Load Parent Theme’s functions.php File

If you use a kid theme, then WordPress will now load your moms and dad theme’s functions.php file.

19. Do Action ‘after_setup_theme’

This step runs after WordPress has setup the theme and loaded theme functions. It is the first action open to themes.

20. Setup Current User Object

Now, WordPress lots the existing user object. Permits WordPress to handle the demand prior to the user’s part and abilities.

21. Do Action ‘init’

WordPress has up to now packed all important information it requires. Now it fires the ‘init’ action.

This course of action permits designers to incorporate code which should be executed after WordPress has packed all earlier mentioned information.

22. Do Action ‘widget_init’

The widget_init action allows designers to register widgets and run code they needed seriously to run at the moment.

23. Run wp()

WordPress now calls wp() function that is located in wp-includes/functions.php file. It creates the WordPress question globals $wp, $wp_query, $wp_the_query after which calls $wp->main.

24. Parse Request

Now WordPress has all the information it needs to parse the consumer request. It starts by checking the rewrite guidelines to complement the user’s demand.

And then runs query adjustable filters, demand action hook, and delivers header demand.

25. Run Query

If no content matches the query, then WordPress will set is_404 variable.

Otherwise, WordPress goes onto load query factors.

It’ll then run WP_Query->get_posts().

Then, it fires DO_ACTION_REF_ARRAY ‘pre_get_posts’ action with WP_Query object.

WordPress will now run apply_filters to wash up question and run some final checks.

Now it fetches articles from database and applies articles_results and the_posts filters.

The question part ends with WordPress coming back the posts.

26. Do Action ‘template_redirect’

WordPress will now run the template_redirect action. This hook runs right before WordPress determines which template web page to load.

27. Load Feed Template

In the event that requested content is just a rss, then WordPress lots the feed template.

28. Load Template

WordPress will now try to find the template file predicated on WordPress template hierarchy. After that it loads the template which often has a WordPress loop.

29. Do Action ‘shutdown’

Right before ending all PHP execution, WordPress fires the last action called shutdown.

WordPress stops working here. It offers run the rule and generated user’s requested web page.

Now, your web web hosting server replies to user’s request by giving them the internet web page produced by WordPress. These pages contains HTML, CSS, and Javascript code, which tells user’s browser how exactly to display it on display screen.

Amazing isn’t it? All these things happen within milliseconds. If you work with one of these brilliant best WordPress web hosting services, then ideally your page will load in several moments.

Develop this short article helped you find out how WordPress works behind the scenes. You may even desire to see our step-by-step guide on how best to improve WordPress speed and performance for beginners.

If you liked this article, then please sign up for our YouTube Channel for WordPress video tutorials. There are also us on Twitter and Facebook.