Created
May 20, 2019 12:18
-
-
Save MaximeCulea/7243ed7781d262fa0115a38fd2126bdd to your computer and use it in GitHub Desktop.
Rewrite to have only one folder for all files
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
<?php | |
/** | |
* For all files into one site folder. | |
*/ | |
//add_filter( 'upload_dir', 'move_uploads' ); | |
function move_uploads( $cache_key ) { | |
$blog_id = get_current_blog_id(); | |
if ( 6 === $blog_id ) { | |
return $cache_key; | |
} | |
$cache_key['path'] = WP_CONTENT_DIR . '/uploads/sites/6' . $cache_key['subdir']; | |
$cache_key['url'] = WP_CONTENT_URL . '/uploads/sites/6' . $cache_key['subdir']; | |
$cache_key['basedir'] = WP_CONTENT_DIR . '/uploads/sites/6'; | |
$cache_key['baseurl'] = WP_CONTENT_URL . '/uploads/sites/6'; | |
return $cache_key; | |
} | |
/** | |
* Remove site rewriting, means all files into upload one. | |
*/ | |
//add_filter( 'pre_site_option_' . 'ms_files_rewriting', '__return_true' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment