Last active
September 4, 2018 15:43
-
-
Save edubacco/36b83ce7fb507f736f8bcf8fd2d4ef54 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
/* | |
* This file is just an example for a woocommerce issue | |
*/ | |
add_action( 'plugins_loaded', 'maybe_custom_upload_dir' ); | |
/** | |
* under some circumstances, we need to move the upload dir | |
*/ | |
function maybe_custom_upload_dir() { | |
if (1) { //if we need to move the upload dir | |
add_filter( 'upload_dir', 'filter_upload_dir' ); | |
} | |
} | |
/** | |
* return the new upload dir path | |
* | |
* @param $dirs | |
* | |
* @return mixed | |
*/ | |
function filter_upload_dir($dirs) { | |
$dirs['path'] = '/mynew/upload/path'; | |
$dirs['url'] = 'www.mysite.com/mynew/upload/url'; | |
$dirs['baseurl'] = 'www.mysite.com/mynew/upload/baseurl'; | |
$dirs['subdir'] = '/mynew/upload/subdir'; | |
$dirs['basedir'] = '/mynew/upload/basedir'; | |
return $dirs; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment