landbryo
2/19/2021 - 6:57 PM

Filter the Elementor Dynamic Assets URL while using the Digital Ocean Spaces Sync plugin

<?php

/**
 * Filter's the URL Elementor uses for enqueuing generated assets
 *
 * @author Landon Otis
 */
add_filter( 'set_url_scheme', function ( $url, $scheme, $orig_scheme ) {

	if ( preg_match( "/elementor\/css/", $url ) ) {
		if ( defined( 'UPLOAD_URL_PATH' ) ) {
			$home = get_home_url();
			$url  = str_replace( UPLOAD_URL_PATH, "{$home}/wp-content/uploads", $url );
		}
	}

	return $url;
}, 99, 3 );