[New Blog Templates] Creating New Site From Template Overwrites Image URL

I have a multisite instance that has several blog templates through the New Blog Template plugin. The images on the multisite instance have been offloaded via Offload S3 and are served through Cloudfront, so no images are stored in the WP uploads folder. We’re also using one of the subdomains as a global media library that points to the Cloudfront images for all the other subdomains to use.

As an example, http://demo-pottershand.outreachapps.com is the blog template, and the images are served through the cdn with the url structure: “http://images.outreachapps.com/wp-content/uploads/sites/53/2018/02/17000807/lightstock_250027_medium_user_43208115.jpg”. Site 53 is the global media library that is being used to point to S3/Cloudfront and http://demo-pottershand.outreachapps.com is using the image urls that it generates to populate the images in its template. When a new blog is generated, the image url changes to “http://harmonybaptistchurch.outreachapps.com/wp-content/uploads/sites/53/2018/02/lightstock_250027_medium_user_43208115.jpg” when it should be: “http://images.outreachapps.com/wp-content/uploads/sites/53/2018/02/17000807/lightstock_250027_medium_user_43208115.jpg”. If the URL was to stay the same, the Offload S3 plugin could filter to the appropriate url, but since the url changes to include the new subdomain, this isn’t possible.

Does somebody know how to have the New Blog Template plugin not replace the URL structure of anything that includes the “uploads” folder? Based on what I’ve seen in past threads, this may have been classified as a bug in the past, but I need this feature ASAP.

Your help would be much appreciated! Thanks.

  • Adam Czajczyk
    • Support Gorilla

    Hello Chris,

    I hope you’re well today and thank you for your question!

    That’s pretty non-standard setup but New Blog Templates has a built-in filter to check whether “attachements URLs” should be changed or not. I think it should help here.

    To use it, please add it to the “functions.php” file of the active theme of the main site or, even better, as an mu-plugin. If you decide to go for “functions.php”, the code to add will be:

    add_filter( 'nbt_change_attachments_urls', '__return_false');

    If you go for mu-plugin, follow these steps:

    – create an empty file with a .php extension (e.g. dont-change-image-urls.php)

    – using a “clean text” editor such as e.g. Notepad++, Sublime or similar open the file and put this code inside

    add_filter( 'nbt_change_attachments_urls', '__return_false');

    – save the file and upload it to your server to the “/wp-content/mu-plugins” folder; if there’s no “mu-plugins” folder inside “wp-content” folder, create one.

    Give it a try please and let me know if it worked for you.

    Best regards,


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.