How many files are in the WordPress core

Wordpress wp-load.php

My question is ... what exactly is in this file that the code needs?

All core functions of WordPress. This includes the design files, all files of the active plugins, etc., BUTWhen loading WordPress, the requested URL is not parsed and the WordPress query is not executed (by initializing the WP object nor the WP_Query objects).

All I understand is that it loads important core wordpress files in order for the website to run correctly (,, etc ...).

Yes, you got it right.

Doesn't that mean that the plugin is already running, that wp-load.php is loaded?

If the plugin code was called by WordPress (e.g. to display an administration page or was included in the originally loaded plugin file), this means that it has already been loaded.

However, sometimes plugins direct requests to individual files (for example) and not to a WordPress powered site (for example or).

Notice how the first URL points to a specific file in the plugins directory, and the second URL is directed to the home page of the website with a query argument added. In the third example, the referenced file is in the directory - here is a special file that makes it easy for plugins to make AJAX requests (this file also loads the WordPress core and triggers some action hooks).

In the case of the first reference, if the plugin wants to use some WordPress features (for referencing the database, editing posts, etc.) it has to load the core WordPress files by including.

It's also a complete waste of resources as it has so many files in it that other files can, and it's like an infinite loop of required files that each load twice (or even more if other plugins are using this.) of method too)

Notice the -part in - this tells PHP to use the file only to be included if not already included. Therefore, there are no conflicts and PHP does not use too much memory. Although - if you are in a context in which WordPress has already started, you should not call the function.


Basically, the author of the plugin expects some requirements to be placed on the plugin file in which you found this code. Since the author wants to use the WordPress functionality in this file, he calls the file to load the core functions.

I'm assuming this is done to reduce server load, although with a couple of hooks running on the action code and a custom parameter added to the home url, the result should still be pretty close.

I personally prefer the second option, but as I said, with becomes prevents WordPress from performing complex operations (URL analysis and database queries).

If there's anything else you don't fully understand, post a comment here and I'll try to explain further.