Created
February 26, 2026 08:15
-
-
Save pirate-bot/c0f12392b732ff089ba4deb10ced7492 to your computer and use it in GitHub Desktop.
Force a particular format for images
This file contains hidden or 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 | |
| /* | |
| Plugin Name: Optimole Tweak - Force a format for all images | |
| Version: 0.0.1 | |
| Requires PHP: 7.0 | |
| Author URI: https://optimole.com | |
| */ | |
| function optml_forced_format() { | |
| add_filter( 'optml_image_args', | |
| function( $args, $original_url ) { | |
| $args['format'] = 'jpg'; // replace jpg with the format you want e.g png,jpg,webp,avif | |
| return $args; | |
| }, | |
| PHP_INT_MAX, 2 ); | |
| } | |
| optml_forced_format(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment