Skip to content

Instantly share code, notes, and snippets.

@mauriciogofas
Last active August 29, 2015 14:15
Show Gist options
  • Save mauriciogofas/dcb431bedb277340dd18 to your computer and use it in GitHub Desktop.
Save mauriciogofas/dcb431bedb277340dd18 to your computer and use it in GitHub Desktop.
Muda a pasta de uploads padrão do WordPress && Change the default upload folder via the WordPress
<?php
/*
* Muda a pasta de uploads padrão do WordPress via functions.php
* mesmo com "define( 'UPLOADS', 'wp-content/'.'uploads' );" em wp-config.php
* Ideal para wp multisite.
* Change the default upload folder via the WordPress functions.php
* Even with "define( 'UPLOADS', 'wp-content/'.'uploads' );" in wp-config.php
* Ideal for wp multisite
* @upload_dir
* @wp_upload_dir
*/
// Start
add_filter('upload_dir', 'gofas_upload_dir');
function gofas_upload_dir($upload) {
$upload['basedir'] = '/var/www/mysite.com/htdocs/uploads';
$upload['baseurl'] = 'http://mysite.com/uploads';
$upload['path'] = $upload['basedir'] . $upload['subdir'];
$upload['url'] = $upload['baseurl'] . $upload['subdir'];
return $upload;
}
// End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment