, WP3.7.1 ( )
, :
add_filter('upload_dir', 'ms_global_upload_dir');
function ms_global_upload_dir($uploads)
{
$ms_dir = '/sites/' . get_current_blog_id();
$uploads['path'] = str_replace($ms_dir, "", $uploads['path']);
$uploads['url'] = str_replace($ms_dir, "", $uploads['url']);
$uploads['basedir'] = str_replace($ms_dir, "", $uploads['basedir']);
$uploads['baseurl'] = str_replace($ms_dir, "", $uploads['baseurl']);
return $uploads;
}
: " URL-" , , $uploads, .
, WP , wp_upload_dir() wp-includes/functions.php : $uploads = apply_filters( 'upload_dir' ...
, .
, ...
In addition, I spent almost two days creating a solution for replicating / deleting downloadable media in each blog using add_attachment and add_attachment using hook, adding the necessary post and postmeta entries to the corresponding database tables. / delete media in any of the blogs that will be displayed / deleted from the library of all blogs. If you are interested, I can share it ...
Greetings
source
share