This will force uploads for all sites to the wp-content/uploads
directory. Sub-directories (like year/month
) will still exist (if the setting is enabled).
/**
* Force all network uploads to reside in "wp-content/uploads", and by-pass
* "files" URL rewrite for site-specific directories.
*
* @link http://wordpress.stackexchange.com/q/147750/1685
*
* @param array $dirs
* @return array
*/
function wpse_147750_upload_dir( $dirs ) {
$dirs['baseurl'] = network_site_url( '/wp-content/uploads' );
$dirs['basedir'] = ABSPATH . 'wp-content/uploads';
$dirs['path'] = $dirs['basedir'] . $dirs['subdir'];
$dirs['url'] = $dirs['baseurl'] . $dirs['subdir'];
return $dirs;
}
add_filter( 'upload_dir', 'wpse_147750_upload_dir' );
Related Posts:
- Specific upload folder for PDFs in custom Post type in WP multisite
- Get upload URL by blog ID in multisite
- Multisite stuck at 1MB for max file size
- Which asset URLs are acceptable in a “vanilla” MU install?
- Can upload doc and pdf but not ppt – not permitted for security reasons
- Listing of all uploaded files in network sites
- Upload path/URL weirdness for the main blog of a multisite/network setup
- Turn off ms-files.php after network setup
- Organize uploaded media files
- How can I have network sites not use year/month folders by default?
- How to upload images manually to wordpress?
- Sharding BLOGUPLOADDIR
- Advanced Custom Fields Multisite Upload/Imagery Issue [closed]
- How to make WordPress use new Upload Path settings in Multisite Setup
- Hook filter to change wp_upload_dir() path in multisite
- Uploading Images to Multi-Site Causes Failure to HTTP Error
- Protect Uploads in Multisite
- .epub file blocked despite ALLOW_UNFILTERED_UPLOADS set to true
- How to get max upload size and accepted file types on multisite?
- Force Uploads Use Yearmonth to off (0) for all existing sites in Multisites
- why when I try to insert an image attachment along with a post does wp_get_attachment_url give me a very wrong file path?
- Images uploading to wrong directory after changing to multisite
- Media library not loading after switching the main site of multisite
- How to stop unlink images when remove a site or user
- Multisite media library uploads broken images
- Upload images from one site to another in Multisite
- Image problem – Multisite image upload broken
- Allow Author on Site A capability to upload files on Site B in Multi Site
- Upload file type not permitted even if explicitly registered as upload_filetypes in the db (multisite)
- Where does multisite store image uploads?
- Error uploading files bigger than 58 MB
- WP doesn’t remove uploads from folder when removed from “Media Library”?
- Problem uploading images
- ‘Cheatin’ uh?’ Error When Attempting to Upload Images After 3.4 Update
- How to protect post attachments related to a custom post type, from non-logged in users, on 1 subsite of a multisite installation?
- Multisite – Images often getting uploaded to the wrong month directory
- Merge Multisites with Shared Network Media Library
- Copying media from multisite subsites to main website
- Show media-frame-menu on custom Media Frame
- How to protect specific uploaded files from being accessed by non-logged-in users in WP-multisite
- Multisite sub-directories IIS 7.5 change media/uploads location
- Make uploads live outside of the WP folder
- Where to set individual blog quotas?
- Save uploads directly in the uploads folder (on a multisite)
- Multisite adjust uploads like (/upload/%alphanumeric_id%/%file_type%/%blog_ID%)
- Automatically Insert Into Post when uploading Media
- Can I use the same Folder name as a Multisite Blog?
- Hiding media uploaded by other users in wordpress multisite?
- Multisite missing tmp folder error while uploading
- Multisite subdirecty added inside URL to uploaded files
- How To Upload Existing WordPress Site To WordPress Multisite Using SSH
- Remove multisite part from wordpress multisite upload directory
- How to set upload path after renaming uploads folder in Multisite?
- Shared upload folder in wordpress multisite with custom sub site domain pictures URL:s
- WordPress Multisite subdomains and sharing the same upload folder
- New wordpress uploads are broken
- Primary site file uploads failing, subdirectory subsites upload fine
- Multi site and media uploader
- MP4 upload ok, but HTTP500 if I update the file (multisite)
- Using MAMP and Xip.io to view a WordPress Multisite on a local network
- Multisite: use media from one site vs. copying the same media to all language sites?
- Subdomain multisite gives 404 on sub sites
- Global Parent theme for all sites
- WordPress Multisite – is it possible to put the main site in a subdirectory?
- the blog owner multisite
- Multisite without .htaccess
- Multisite installation on IIS gives 404 trying to access the admin dashboard
- Is Partial SSL Possible? ( multisite )
- How to properly force https and www on multisite with Apache HTAccess
- Why does the My Site dropdown show only a single domain?
- Performance on WPMS
- Display site administrator’s id by current blog id inside link
- SELinux security vs WordPress updates
- Switch MultiSite main site with another (multilingual sites) – with subfolder – no subdomain
- WordPress Multisite’s in subdirectory not redirecting to dashboard settings
- Updated to version 3.8 and Admin pages are very slow. How to diagnose problem? [closed]
- Multisite install on subdomain w/ subdomains change siteURL
- Error : Cookies are blocked or not supported by your browser
- How To Run Multiple Multi-Site Networks On Same Box [closed]
- How to use the sunrise.php script for Multisite network domain mapping?
- How to pull data from child installation to parent theme
- Which is the correct way to migrate content from single WP to WP multisite
- How to have one installation at blog.example.com and multiple blogs in sub folders such as blog.example.com/userA?
- Running hundreds of WP in multisite
- Bitnami multisite change URL of secondary blog
- Number of total comment does not tally with the number of comment?
- Domain not redirected correctly with WordPress Multisite
- WordPress theme to support single website but with 3 sections for 3 languages
- Can assign a new domain to a site in a multisite?
- Possible to have duplicate usernames on different two multisites
- Including non-wordpress pages within a single multisite domain
- How can I import posts into different wordpress multisites at once?
- Redirect www.mainsite.com/subsite/wp-login to www.mainsite.com/wp-login
- Activation of new Registered site fails on multisite
- How to login a user with wp_set_auth_cookie on a specific blog within a multisite environment
- How does adding custom meta to signup form work?
- Can’t un-archive site after upgrading to WordPress 3.8
- How to handle responsive and non responsive websites in one WordPress Theme?
- Swap domains of two sites with each other in multisite
- Many big issues in the website, WP_Debug not showing