Skip to content

Instantly share code, notes, and snippets.

@mgibbs189
Last active May 29, 2020 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgibbs189/c193809c9c157b580914940119f3e405 to your computer and use it in GitHub Desktop.
Save mgibbs189/c193809c9c157b580914940119f3e405 to your computer and use it in GitHub Desktop.
WP Rocket + CDN + FacetWP Template
<?php
// Add to your (child) theme's functions.php
// @link https://docs.wp-rocket.me/article/90-getrocketcdnurl
add_filter( 'facetwp_render_output', function( $output, $params ) {
if ( function_exists( 'get_rocket_cdn_url' ) ) {
$html = $output['template'];
$html = str_replace( get_home_url(), get_rocket_cdn_url( get_home_url() ), $html );
$output['template'] = $html;
}
return $output;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment