4

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?

5

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...

  • Can you shortly explain why? i mean isn't Wordpress loading each plugin separately each time makes the site's loading time a bit slower? (i'm talking front-end user only, i don't mind the admin to be slower a bit) – mondi Jul 15 '18 at 15:21
  • @mondi updated my answer. – Krzysiek Dróżdż Jul 15 '18 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.