Skip to content

Commit

Permalink
replace static upload dir by upload_dir()
Browse files Browse the repository at this point in the history
  • Loading branch information
lphoumpakka committed Nov 13, 2020
1 parent 6d8ca3f commit ccda18b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mercator-domain-replacements.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
Plugin Name: Mercator Domain Replacements
Version: 1.0.0
Version: 1.0.1
Plugin URI: https://beapi.fr
Description: Force the replacement of all the original domains of the network by the corresponding mapped domains
Author: Be API
Expand Down Expand Up @@ -89,7 +89,9 @@ public function translate_network_url() {

// Network domain URL
if ( $network_domain_internal !== $domain_mapped ) {
$this->domains[ $network_domain_internal . '/content/uploads/' ] = $domain_mapped . '/content/uploads/';
$upload_mapped_url = wp_upload_dir()['baseurl'];
$upload_path = str_replace( $domain_mapped, '', $upload_mapped_url );
$this->domains[ $network_domain_internal . $upload_path ] = $domain_mapped . $upload_path;
}
}

Expand Down

0 comments on commit ccda18b

Please sign in to comment.