Skip to content

Instantly share code, notes, and snippets.

@jmdodd
Created October 27, 2011 11:20
Show Gist options
  • Save jmdodd/1319304 to your computer and use it in GitHub Desktop.
Save jmdodd/1319304 to your computer and use it in GitHub Desktop.
Unmask file locations in a WordPress Multisite installation (for WP 3.0)
<?php
if ( ! function_exists( 'ucc_upload_dir_wp30' ) ) {
function ucc_upload_dir_wp30( $uploads ) {
// Set these options in Super Admin > Sites > Edit > Upload Path and Upload Url Path.
$upload_path = get_option( 'upload_path' ); // Example: /home/username/public_html/wp-content/blogs.dir/2/files
$fileupload_url = get_option( 'fileupload_url' ); // Example: http://sub.domain.com/wp-content/blogs.dir/2/files
$uploads['baseurl'] = $fileupload_url;
$uploads['url'] = $fileupload_url . $uploads[ 'subdir' ];
$uploads['basedir'] = $upload_path;
$uploads['path'] = $upload_path . $uploads[ 'subdir' ];
return $uploads;
} }
add_filter( 'upload_dir', 'ucc_upload_dir_wp30' );
/*
Copyright 2011 Jennifer M. Dodd (email: jmdodd@gmail.com)
Released under the GPLv2 (or later).
*/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment