[wp-hackers] Where Should Plugins Store Files?
dougal at gunters.org
Mon Sep 13 22:43:10 UTC 2010
On Sep 13 2010 4:56 PM, Ryan McCue wrote:
> Dougal Campbell wrote:
>> But you can't always depend on it to be writable, so you'd want to
>> fall back to the uploads dir (and of course, handle errors when that's
>> not available either). I'd check which directory was available at
>> plugin activation time, and store the result in an option, so that you
>> stay consistent once you've started using one location or another.
> As I mentioned, the plugin doesn't create the directory or file, so
> whether the plugin can write to it or not is irrelevant.
> Jacob Santos wrote:
>> This would break on my system. I specifically set the uploads directory with
>> "full" permissions meaning write / read by apache. No other directory has
>> these read / write permissions.
> Again, the plugin *only reads from the directory*, it doesn't need write
I don't see where you specifically said that. You mentioned the user
creating the directory themselves, but from the context, it looked like
you were still asking a similar question to the original poster in this
If we're talking about files that are just part of the plugin, and which
do not need to be created post-install, and which do not need to be
modified by the user, then they should just stay with the plugin itself,
perhaps within a sub-folder. But for files which the plugin needs to
create, or which might need customizations which we don't want to lose
when the plugin is upgraded, then I suggest a sub-folder either under
wp-content, or under the uploads directory.
Personally, I wouldn't be opposed to a standardized
'wp-content/plugin-data/' folder, with a few convenience functions in
core (e.g., plugin_data_directory() and plugin_data_uri()).
Dougal Campbell <dougal at gunters.org>
More information about the wp-hackers