Created
April 8, 2016 07:12
-
-
Save ggeorgaras/56e37c830c0837aac7dace1765b45b97 to your computer and use it in GitHub Desktop.
Shared upload folder in wordpress multisite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment