• Dear WordPress plugin developers…
    … I use a custom installation of WordPress where I share themes and plugins folder, using only a different database,
    to save time in updates and security.

    It always worked, since 2007.

    Recently, I had problems with a few plugins that saves stuff into their own folder (like wp-content/plugins/plugin-name/) because this files are shared between my installations of WordPress.

    I feel that this is a very bad behaviour, because best places to store site-per-based informations is the database,
    and if you do it to save network bandwidth (like caching CSS and JS) you should definetly store that files into get_stylesheet_directory() or wp_upload_dir().

    Am I crazy? This seems a basic “rule” to me …

    I readed the guides and I can’t find a page where this is written.

    Can you help me ?

Viewing 11 replies - 1 through 11 (of 11 total)
  • What is it that these plugins are actually saving? Or are they just loading their own CSS and JS files?

    You’ve got a strange setup for WordPress; you’ve got to expect some issues.

    Thread Starter ELAN42///

    (@nokao)

    Some of them are uploading JS and CSS files,
    that -of course- get wiped out by WordPress updates.

    Isn’t this a wrong behaviour ?
    Isn’t there a guide of best-practices on where to store stuff that I can show them ?

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    You could put it in wp-content/uploads/your-plugin-slug or just wp-contents/your-plugin-slug

    If they have their own css and js files, and they are properly located, as per Steve, they won’t get wiped out by a WordPress update. Unless, of course, you’ve done something funky with your WP install.

    Thread Starter ELAN42///

    (@nokao)

    I totally agree with the both of you,
    infact I’m criticizing plugins that store files inside:
    wp-content/plugins/plugin-name/

    Are there some documentation / link / guide / codex
    where this behaviour is discouraged ?

    Are there some documentation / link / guide / codex
    where this behaviour is discouraged ?

    Not that I’m aware of. Plugins should, by default, be loading their css and js files from their own directory. These items will not get wiped out by a WordPress core update, unless you’ve done something weird with your WP install.

    Can you clarify something. Are you saying the CSS & JS files are created later, and not part of installtion?

    It’s perfectly normal (and expected) for plugins to bundle their assets in the plugins folder. If the plugin is writing files after installation that are not part of the original bundle then they should be doing that in the /wp-content/uploads folder because it’s the only folder guaranteed to have the correct permissions. I can’t think if why any plugin would write files to its own folder though, because of the update issues that you mention. I feel like there must be a misunderstanding here.

    There isn’t a specific rule for file creation and management as far as I know.

    Some plugins will create files into /wp-content/ for example backup plugins. Some cache plugins use their own plugin folder but others do put their minifications into the /uploads/ folder and so on so forth.

    It depends on the plugin and what the author has decided that needs to be done.

    For example: I’ve made a custom export to .xlsx plugin for a client. I’m using the plugin folder to save the temp file and push it for download as it’s huge so that file will basically stay into the plugin folder. IF the plugin gets updated that file is lost but I don’t mind since the client has already made the download or he can just generate a new one. Either good or bad it was just a preference to keep it into the plugin folder for no reason other than having a clean file system as he does whatever he likes with his other part of the websites etc and he might accidentally delete an ongoing export if I had it on /uploads/.

    What I don’t understand is which css / js files you are mentioning though.

    If they are minifications of the website then the author might have decided that it’s easier for him/he to wipe them on an update of his plugin so they get automatically re-generated through his new code or for whatever else reason.

    If you mean about the ones the plugin is using then those are needed by the plugin and should be there either way and of course they will be replaced by their newer versions when an update happens.

    But Steve & Jacob folder mentions above, should be the preferred choice for ‘persistent’ files either way.

    Thread Starter ELAN42///

    (@nokao)

    Excuse me if I was not clear:

    Can you clarify something. Are you saying the CSS & JS files are created later, and not part of installtion?

    YES !

    This plugin is storing css and js inside wp-content/plugins/plugin-name/
    AFTER it’s installation and use.

    My question is about WordPress documentation:
    is there an official page where this behaviour is discouraged ?

    Are you sure that’s what’s happening? I can’t imagine why a plugin would be *generating* CSS and JS files after installation (JS especially), let alone storing them in the plugin. Are you sure you’re not hacked? What’s in these files? Do they look legitimate?

    Regardless, I haven’t seen any warning in official documentation. The Best Practices” documentation is pretty sparse. You can also look at the directory’s guidelines but there’s no mention of this there. I’m don’t know if it’s *forbidden* though. You could ask [email protected] if it’s allowed in the plugin directory, but if it’s not a public plugin then WordPress doesn’t enforce anything like this.

    is there an official page where this behaviour is discouraged ?

    No. Nor does there need to be one. WordPress is pretty lenient about how theme and plugin creators get things done, as long as it follows the most minimal set of guidelines required.

    As @jakept said, creating these files seems like pretty dodgy behavior. I can imagine having one or two that would do that, but a whole slew of them? I’m definitely beginning to think there is something fishy going on here.

    Which plugins are these? If we knew, we could check them out ourselves to see what is their default behavior.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Plugin developement – where to store stuff (other than the database)’ is closed to new replies.