Plugin CLI Commands
You can use WP-CLI to interact with the Optimole WordPress plugin:
Here are the commands available and the description for them:
Connect the Pluginwp optimole connect <api_key>
Use this command to connect the plugin with an API key.
Disconnect the Pluginwp optimole disconnect
Use this command to disconnect the plugin if required.
Clearing cache
wp optimole setting clear_cache --type=<type>
'type' defaults to images and can be changed to assets.
Update Settings
wp optimole setting update <setting_name> <value>
Use this command to update a setting from the CLI. Available settings and accepted value types:
image_replacer => 'on'/'off' quality => int lazyload => 'on'/'off' lazyload_placeholder => 'on'/'off' network_optimization => 'on'/'off' img_to_video => 'on'/'off' resize_smart => 'on'/'off' retina_images => 'on'/'off' native_lazyload => 'on'/'off' video_lazyload => 'on'/'off' bg_replacer => 'on'/'off' scale => 'on'/'off' cdn => 'on'/'off'
Eg. wp optimole setting update image_replacer off
Observations:
1. cdn option is referring to serving css, js and fonts through our content delivery network
2. img_to_video option means converting animated GIF images into video format
Get Settings Valuewp optimole get <setting_name>
This command returns the current setting value the same setting_name apply.