Last active
May 29, 2020 17:48
-
-
Save mgibbs189/c193809c9c157b580914940119f3e405 to your computer and use it in GitHub Desktop.
WP Rocket + CDN + FacetWP Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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