eventsmanager

Disable Stripe.js on non-event pages

Jul 27th, 2020
1,444
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /*
  3. This script will disable stripe from loading its JS file on every page on your site,
  4. apart from event pages and page with ID 123. Edit 123 to your desired page.
  5. To just load this on event pages, remove 'is_page(123) ||' from the code below.
  6.  
  7. For installation instructions see here - http://wp-events-plugin.com/tutorials/how-to-safely-add-php-code-to-wordpress/
  8. */
  9. add_action('wp_enqueue_scripts', function(){
  10.     if( !(is_page(123) || em_is_event_page()) ){
  11.         wp_dequeue_script('stripe-v3');
  12.     }
  13. }, 100);
RAW Paste Data