WordPress Default upload directory is located in Wp-content/uploads, and according to the settings can also be archived by year. But is it always nice to have an avatar, or a slideshow, mixed with attachments? Fortunately, WordPress knows there will be users have this demand, we can use the filter to temporarily change the file upload directory. The filter function is as follows:
functionSlider_upload_dir ($uploads) { $siteurl= Get_option (' SiteURL ' ); $uploads[' path '] = Wp_content_dir. '/slider '; $uploads[' url '] =$siteurl. '/wp-content/slider '; $uploads[' subdir '] = '; $uploads[' basedir '] =$uploads[' Path ']; $uploads[' baseurl '] =$uploads[' URL ']; $uploads[' ERROR '] =false; return $uploads;} Add_filter (' Upload_dir ', ' slider_upload_dir ');
This uploads files will be uploaded to the Wp-content/slider directory! This method is especially suitable for items that have uploaded avatar or slideshow requirements, and can avoid confusing these files with the article attachments.
Modify WordPress File upload Directory