WordPress - Create a Directory Within Uploads Folder


SUBMITTED BY: Guest

DATE: Nov. 27, 2013, 11:03 p.m.

FORMAT: PHP

SIZE: 326 Bytes

HITS: 891

  1. function myplugin_activate() {
  2. $upload = wp_upload_dir();
  3. $upload_dir = $upload['basedir'];
  4. $upload_dir = $upload_dir . '/mypluginfiles';
  5. if (! is_dir($upload_dir)) {
  6. mkdir( $upload_dir, 0700 );
  7. }
  8. }
  9. register_activation_hook( __FILE__, 'myplugin_activate' );

comments powered by Disqus