• Resolved jetxpert

    (@jetxpert)


    Good Day!

    Hey, great plugin.

    We are using WP Rocket, SG Optimizer, Gravity Forms, and Gravity Forms Stripe Add-On.

    You plugin solved an issue we had with one of our website pages using the Gravity Forms Stripe Add-On, but messed up all other pages (i.e., page caching, lazy loading, etc.) where we also use Gravity Forms but not the Stripe Add-On.

    Is their any way we can apply your plugin to one or selected pages instead of all those containing a Gravity Form? If not, can you provide a Code Snippet for this purpose?

    Note: Yes, we know that using two caching plugins is not recommended. So, in our case, our settings for WP Rocket and SG Optimizer do not overlap (double-checked, they work fine together).

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Samuel Aguilera

    (@samuelaguilera)

    Hello,

    Sorry for the delay, for some reason I missed the notification of this forum thread.

    The purpose of the plugin is to automatically exclude all pages with a form. There’s no
    filter to limit its action only to specific pages, that would break the original idea of the plugin and would be the same than excluding your pages using SG Optimizer or WP Rocket settings, so I would recommend you to uninstall Fresh Forms and use SG Optimizer/WP Rocket settings to exclude your pages, they have also filters. I’m sure the support team for these plugins will be able to help you with that.

    Thread Starter jetxpert

    (@jetxpert)

    Hi @samuelaguilera,

    Thank you for the information. Much appreciated.

    To your surprise (and ours), we just solved the issue we reported above by creating a code snippet that uses the filters provided by SiteGround Optimizer and the data contained in one of your plugin files.

    Solution:

    Use the following code snippet (add it to your functions.php file or via the Code Snippet plugin):

    add_filter( 'sgo_javascript_combine_exclude', 'js_combine_exclude' );
    function js_combine_exclude( $exclude_list ) {
        $exclude_list[] = 'stripe.js';
        $exclude_list[] = 'stripe_v3';
    	$exclude_list[] = 'gforms_stripe_frontend';
    	
        return $exclude_list;
    }
    
    add_filter( 'sgo_javascript_combine_excluded_inline_content', 'js_combine_exclude_inline_script' );
    function js_combine_exclude_inline_script( $exclude_list ) {
        $exclude_list[] = 'var stripe';
    
        return $exclude_list;
    }
    
    add_filter( 'sgo_javascript_combine_excluded_external_paths', 'js_combine_exclude_external_script' );
    function js_combine_exclude_external_script( $exclude_list ) {
        $exclude_list[] = 'js.stripe.com';
    
        return $exclude_list;
    }

    Notes:

    (a) The above code snippet only applies to pages (i.e., gravity forms) that use the Stripe Checkout Add-On.

    (b) The above code allows caching of pages that use Gravity Forms without the Stripe Checkout Add-On. The pages are cached, but not the form (Ajax enabled) data.

    (c) Thanks to the above code snippet (and your plugin), we are now able to get rid of WP Rocket and only use SiteGround Optimizer.

    We appreciate the effort you have spent putting together this plugin. It’s a great plugin!

    You’ve earned another five-star review ??

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Use Plugin on Target Pages Only’ is closed to new replies.