[wp-hackers] Where Should Plugins Store Files?

Andrew Nacin wp at andrewnacin.com
Mon Sep 13 04:52:15 UTC 2010

On Sun, Sep 12, 2010 at 11:39 PM, Piyush Mishra <me at piyushmishra.com> wrote:

> If the file isnt of any use out side the plugin, I use the plugin itself

That's a bad idea. Then you lose that file on an upgrade.

You can use wp_mkdir_p($path) to create a folder. (The _p means it attempts
to set permissions.) If fails, it will return a WP_Error object.

As Otto said, use wp_upload_dir() to get the path to the upload directory.

More information about the wp-hackers mailing list