How to create a directory within the uploads folder

When developing a plugin or theme, it can be useful to be able to programmatically create a directory within the wp-content/uploads folder. Here is a handy piece of code to do it. Simply paste this code snippet on your functions.php file (or plugin file if you’re creating a plugin) function myplugin_activate() { $upload = wp_upload_dir(); $upload_dir = $upload[‘basedir’]; $upload_dir = $upload_dir .

visit Wprecipes

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: