-
-
Save codebycarter/0da275565be972311036 to your computer and use it in GitHub Desktop.
Filter for disabling Autoptimize's optimizations if Beaver Builder is being used or add your own condition(s)
This file contains 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
add_filter( 'autoptimize_filter_noptimize', 'your_prefix_autoptimize_filter_noptimize' ); | |
/** | |
* Add our own conditions for when Autoptimize's optimizations should be disabled. | |
* | |
* @since {version} | |
* | |
* @return bool | |
*/ | |
function your_prefix_autoptimize_filter_noptimize() { | |
// Disable if user is using Beaver Builder. | |
if ( isset( $_SERVER['REQUEST_URI'] ) && false !== strpos( $_SERVER['REQUEST_URI'], 'fl_builder' ) ) { | |
return true; | |
} else { | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment