Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function upgrader_source_selection_filter($source, $remote_source=NULL, $upgrader=NULL){
Github delivers zip files as <Username>-<TagName>-<Hash>.zip
must rename this zip file to the accurate theme folder
$upgrader->skin->feedback("Executing upgrader_source_selection_filter()...");
if(isset($source, $remote_source, $upgrader->skin->theme)){
$corrected_source = $remote_source . '/' . $upgrader->skin->theme . '/';
if(@rename($source, $corrected_source)){
return $corrected_source;
} else {
$upgrader->skin->feedback("Unable to rename downloaded theme.");
return new WP_Error();
else {
$upgrader->skin->feedback('!![SOURCE SELECTION FILTER FAILED]!!');
$msg = '$source:'.var_export($source, true); echo PHP_EOL;
$msg = '$remote_source:'.var_export($remote_source, true); echo PHP_EOL;
$msg = '$upgrader->skin->theme:'.var_export($upgrader->skin->theme, true); echo PHP_EOL;
return $source;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment