I have different functionality add-ons to my WordPress site, so usually i just create one plugin with all my custom functions.
Now i want to separate this plugin to multiple plugins (one for each function or so, to be more organised and also to be able to turn specific functions on and off easily and pass specific functions from site to site without having to pass the whole plugin and then customising it to have only the functions i want in this specific site…).
So my question is:
Will it make my site slower in any way (the same code but chopped to multiple plugins instead of compiled into one..)?
Also – do you think that might be other disadvantages for that approach?
If it’s exactly the same code, then no – it shouldn’t cause any performance changes…
Why? Because loading a plugin is pretty easy (hence quick) process. It all happens in wp-settings.php
and this is the code:
// Load active plugins.
foreach ( wp_get_active_and_valid_plugins() as $plugin ) {
wp_register_plugin_realpath( $plugin );
include_once( $plugin );
}
unset( $plugin );
As you can see, it’s just one loop. And wp_get_active_and_valid_plugins
is pretty simple to – it just loads on option (active_plugins
) and then loops through that array and checks if files exist…
So, no matter how many plugins are there, only one option is loaded from DB and there are no costly operations connected to loading a plugin (unless plugin does something complicated itself).
PS. Of course I assume that the count of these plugins will be reasonable – if you’ll chop that code and end with 1000 plugins, then it can cause some (but still rather minor, mainly during checking for updates, I guess) problems…