Adding the following code into the directory wp-content/mu-plugins/ activates a must use plugin explained in a bit more detail here .
This plugin changes the default upload url to
example.com/wp-content/uploads/sites/n/_mediavault/year/month/ for multisite and
example.com/wp-content/uploads/_mediavault/year/month/ for single site
This default behaviour applies to anything uploaded from anywhere which negates the need to add an enable protection option to the add media modal.
<?php
/*
Plugin Name: Custom Upload Dirs
Description: Changes the upload directory to what we would like, instead of what WordPress likes.
Author: Mark
Version: 1.0
Author URI: https://maxicheapit.com.au/
*/
add_filter('upload_dir', 'maxi_custom_upload_dir');
/**
* Changes the upload directory to what we would like,
* instead of what WordPress likes.
*/
function maxi_custom_upload_dir($upload) {
$upload['path'] = $upload['basedir'] . '/_mediavault/'.current_time('Y'). '/' .current_time('m');
$upload['url'] = $upload['baseurl'] . '/_mediavault/'.current_time('Y'). '/' .current_time('m');
return $upload;
}
?>