This walkthrough sets up compression together with the Jetpack CDN plugin to create faster page loads.
By default, it sets the compression of images on the site to 80% quality to speed up load times. Adjust this by changing the 80
on line 3 of the code.
- Install Code Snippets on your site: https://wordpress.com/plugins/code-snippets
- Activate code snippets either on that installation page or by going to My Site → WP-Admin → Plugins
- Go to My Site → WP-Admin → Snippets → Add New.
- Create a new snippet and give it a name that explains itself, such as: Jetpack Image CDN Compression
- Copy and paste the following PHP code into the Code text area:
add_filter('jetpack_photon_pre_args', 'jetpackme_custom_photon_compression' );
function jetpackme_custom_photon_compression( $args ) {
$args['quality'] = 80;
$args['strip'] = 'all';
return $args;
}
- Choose "Run snippet everywhere."
- Save the changes.
Once you finish this process, the compression will begin working on your site the next time it loads. If you have any issues, please let our support know and we can help.