Skip to content

Instantly share code, notes, and snippets.

@labboy0276
Created June 8, 2021 02:14
Show Gist options
  • Save labboy0276/24b032421c072774fed003c37c0f0f4b to your computer and use it in GitHub Desktop.
Save labboy0276/24b032421c072774fed003c37c0f0f4b to your computer and use it in GitHub Desktop.
Smush PRO Bedrock patch
diff --git a/core/modules/class-cdn.php b/core/modules/class-cdn.php
index d86d910..2af3541 100644
--- a/core/modules/class-cdn.php
+++ b/core/modules/class-cdn.php
@@ -430,7 +430,7 @@ class CDN extends Abstract_Module {
$src = apply_filters( 'smush_filter_generate_cdn_url', $src );
// Support for WP installs in subdirectories: remove the site url and leave only the file path.
- $path = str_replace( get_site_url(), '', $src );
+ $path = str_replace( WP_HOME, '', $src );
// Parse url to get all parts.
$url_parts = wp_parse_url( $path );
@@ -1496,4 +1496,4 @@ class CDN extends Abstract_Module {
return getimagesize( $path );
}
-}
\ No newline at end of file
+}
@labboy0276
Copy link
Author

Also add this to your wp-config:

define( 'WPMUDEV_HUB_SITE_URL', 'https://yoursite.com/' );
define( 'WP_SMUSH_API_DOMAIN', 'https://yoursite.com/' );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment