1

I'm working on a rather large WordPress project with over 40 plugins, also including a bunch of custom-made plugins specific to this project.

This makes navigating the WordPress plugins folder rather troublesome. Is it possible to "organize" the plugins folder to look more like the example below?

- plugins
    - wp-plugins // All plugins downloaded from WordPress
    - custom-plugins // All custom written plugins
  • 1
    if you have difficulty navigating your plugin folder then chances are you have too many installed. – Aurovrata Apr 12 '18 at 11:56
  • Not without hacks, and then a lot of functionality will stop working, e.g. updates, and the plugin screen, you'd lose the ability to activate and deactivate things, the plugin folder API would stop working and you'd have to start modifying plugins, hardcoded paths in plugins would break, basically you could do it but it's a lot of work that needs doing over and over again, with things that will never work. You might think that you're making things easier doing this, but trust me, you're creating work for yourself and unnecessary pain with no benefits – Tom J Nowell Apr 12 '18 at 12:06
  • As @Aurovrata says, if you have 40 plugins and have difficulty navigating them, then you have too many installed... If your custom plugins are specific only to that particular site/project, then why not consolidate them all in to just one plugin, separating the code within sub-folders of the plugins own folder? – Mat Apr 12 '18 at 12:13
  • I know that slapping 100 plugins on a WordPress site is a common mistake newbie developers make. But saying I have "too many installed" is useless input, and quite frankly, a little insulting. As I said before, this is a very large WordPress project, and these plugins are all carefully selected and necessary. – Swen Apr 12 '18 at 12:49
  • 1
    Hey @Swen, no disrespect meant, this is a very common issue with WP installations, so its natural that we point out that this could be the case. If you do not wish for such "useless input" may I suggest that you take compose your question so that we are not induced into such suggestion. Remember, we are all volunteering to help here! – Aurovrata Apr 12 '18 at 12:59
1

Short answer is no.

WordPress defines plugin paths allowing plugins authors to use plugin content functions to locate their files, and these are controlled by the WordPress content constants which are set in the file

wp-includes/default-constants.php

However, although the path are customisable, WordPress only searches this one location. The only exception to this is network installations which have an extra folder muplugin which WP will scan for must-use plugins.

WordPress calls the function wp_get_active_and_valid_plugins to load plugins at run time, but does not provide any hooks to modify the loading process.

1

In a way it is possible.

A plugin by definition is a file that has the plugin header and it is located either at the plugins directory, or one layer "lower". If all of your custom plugins are just one file each, it will be easy to create a directory structure as you wish. Bigger plugins can technically also be done this way, but from a development POV you will probably find it harder to manage the development of each one of them and create an update flow (git for example assumes that the whole subtree of a directory belong to one project, and it will be hard to manage several subtrees on the same directory).

It should be much easier to make a one big plugin organized as modules, with a control panel that controls the modules. This should be good enough since functionality like updating and deleting is not relevant to your custom plugins.

OTOH you should probably consider just moving those plugins into your theme code. While the overhead of having code as plugin is probably zero, it is just pointless to have such a separation between parts of your own code.

  • Isn't it a good idea to keep custom functionality in plugins separate from theme code in case the theme is ever changed in the future and functionality needs to be maintained? – Mat Apr 12 '18 at 14:59
  • well, can the plugin actually function without that specif theme? If the plugin can not work with just any theme, than it is not very portable. My rule of thumb when developing sites is that everything goes in the theme, the exception are when you know that some functionality will need to be shared between different themes. I found out at a very young professional age that it is actually very hard to predict which parts of a code will need to be reusable, and I try to avoid forcing the code to be reusable if not presented with actual use case. – Mark Kaplun Apr 12 '18 at 15:10

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.