1. Home
  2. Knowledge Base
  3. Developer Docs
  4. Hooks – Whitelist Scripts or Styles

Hooks – Whitelist Scripts or Styles


In order to have the fastest loading landing pages, sales pages, and other pages, we disable most 3rd party plugin/theme scripts when using the Blank OptimizePress template.

Usually, these can be enabled by following instructions in this article.

But, if 3rd party plugin is using a unconventional handle or way to enqueue their scripts, we added a few helpful filters to allow 3rd party developers to whitelist their scripts or styles.


The filter for scripts is:

return apply_filters('op3_script_is_allowed_in_blank_template', false, $handle);

Below is an example usage of the above:

// Paid Membership Pro fix for Stripe
if (defined('PMPRO_VERSION')) {
    add_filter('op3_script_is_allowed_in_blank_template', [$this, 'allowPmproScripts'], 10, 2);

And the code inside allowPmproScripts is below:

public function allowPmproScripts($value, $handle)
        if ($handle == 'stripe') {
            return true;

        return $value;

As you can see, the method uses a script’s handle and if it is matched, it simply returns true.


We have a similar filter for Styles as well:

return apply_filters('op3_style_is_allowed_in_blank_template', false, $handle);

And the simple example of usage:

if (class_exists(\AccessAlly::class)) {
    add_filter('op3_style_is_allowed_in_blank_template', [$this, 'allowAccessAllyFrontendStyles'], 10, 2);

And the code inside allowAccessAllyFrontendStyle is below:

public function allowAccessAllyFrontendStyles($value, $handle)
        if ($handle == 'accessally-frontend-styling') {
            return true;

        return $value;

Again, looking for style’s handle and if it is matched, it will return true, thus including the style in the blank template.

Updated on June 20, 2023

Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for? Don't worry we're here to help!
Contact Support