Force WebP replacement on more attributes
WP Rocket's WebP cache feature looks for images in specific attributes to replace them with the WebP version. If you have an image found in an unsupported attribute, you can force the WebP replacement by using this helper plugin.
📝 Manual code edit required before use!
You must edit the line beginning with
$attributes to reflect the custom attribute(s) you want to use.
- Download the helper plugin zip file, then un-zip it.
- Open the PHP file in a text editor.
- Edit line 31 to replace
data-thumbwith the attribute you want to use, and save the file. To add multiple attributes, duplicate line 31 as needed, for each attribute you want to add.
- Re-zip the folder.
- Install the helper plugin on your site - go to Plugins → Add New → Upload plugin
and select the zip file.
- Activate the plugin
- Clear the WP Rocket cache