Modify WordPress File upload Directory

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.