Setting plugin options via wp-config

You can use constants defined inside wp-config.php to interact with the Optimole WordPress plugin:

To enable the use of settings from wp-config.php first define OPTMIL_USE_ENV constant to be 'true' inside wp-config.php, right after this line:

/* That's all, stop editing! Happy publishing. */

like this: 

/* That's all, stop editing! Happy publishing. */  

define( 'OPTIML_USE_ENV', 'true' );

After doing this you can define all the settings that you want to modify one per line just below the one from above, for example: 

/* That's all, stop editing! Happy publishing. */    

define( 'OPTIML_USE_ENV', 'true' );
define( 'OPTIML_IMAGE_REPLACER', 'on' );
define( 'OPTIML_NATIVE_LAZYLOAD', 'off' );
define( 'OPTIML_IMG_TO_VIDEO', 'on' );
define( 'OPTIML_QUALITY', '75' );

Available settings and accepted value types:

OPTIML_IMAGE_REPLACER         => 'on'/'off' 
OPTIML_QUALITY                => int 
OPTIML_LAZYLOAD               => 'on'/'off'  
OPTIML_IMG_TO_VIDEO           => 'on'/'off'  
OPTIML_RESIZE_SMART           => 'on'/'off'  
OPTIML_RETINA_IMAGES          => 'on'/'off'  
OPTIML_NATIVE_LAZYLOAD        => 'on'/'off'  
OPTIML_VIDEO_LAZYLOAD         => 'on'/'off'  
OPTIML_BG_REPLACER            => 'on'/'off'  
OPTIML_SCALE                  => 'on'/'off'  
OPTIML_CDN                    => 'on'/'off'


1. OPTIML_CDN option is referring to serving css, js and fonts through our content delivery network 

2. OPTIML_IMG_TO_VIDEO means converting animated GIF images into video format 

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us