Creating directory in uploads – wp_mkdir_p() or WP_Filesystem?

wp-content/uploads/ should be writable for the server (otherwise it would be impossible to upload a file, no?). If you are going to create something under this directory, it is safe to use wp_mkdir_p().

I would only use WP_Filesystem if there is a chance the server does not have permissions to write to the location, like in wp-content/plugins/, which does not have to be writable for the server (at least I think it doesn’t have to be?).

Sidenote: The File Permissions page of the Codex also talks about a wp-content/cache/ directory. Would this be a “more standard” location for cache files?

Leave a Comment