How does WordPress work (under the hood)?

[ad_1]

Do any of you have a resource that explains how WordPress works under the hood? I understand what the files do. I don’t understand when they’re processed.

Sites have 10s of thousands of files. WP can’t read them all every time a URL is requested, can it? Are they all read in advance and kept in RAM? If they’re read in advance, what triggers that?

Has anyone seen a general overview of the order of operations? Which groups of files get loaded when.

I’ve been content with building themes and plugins. But I need to do some optimization and I realized that I actually don’t know how WordPress works.

[ad_2]
4 Comments
  1. I wouldn’t attempt making changes to WP core. If you’re interested in how your template is loaded check out

  2. There is a difference between the web server interacting (and serving) with files, and having another system sit on top of the web server that serves out “files”.

    Technically all of your pages sit inside the database that WordPress reads from. There aren’t 10s of thousands of files. One of my sites was built on html, so had a couple thousand html files sitting on the web server. Updating that was a pain, so I moved to WordPress.

  3. You can always go to the source: [https://github.com/WordPress/WordPress]) – and the Codex explains how everything works [https://codex.wordpress.org/])

    Something you will probably find useful is the Query Monitor plugin (not advisable for production!) [https://wordpress.org/plugins/query-monitor/]) – it adds a menu bar to every page and you can see which hooks and actions were run for that page, along with all queries and a lot of other info.

    “Sites have 10s of thousands of files. WP can’t read them all every time a URL is requested, can it? Are they all read in advance and kept in RAM?” – most hosts runs OPCache which caches compiled php files in memory, you can also have page caching, and object caching to store database results.

    And if you really want to see everything going on then enable xdebug and do some line by line debugging. I use this in VSCode and you can set breakpoiints, view all variables etc. Again, not advisable for production, I’ve only done this on WordPress sites running on my local machine, but you should be able to do this remotely too I believe.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer