Created
November 20, 2020 19:57
-
-
Save ronalfy/0ae14f6ef326a91ab07ca74d68b0b2cc to your computer and use it in GitHub Desktop.
PMPro - Prevent Multiple jQuery Scripts From Running
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
<?php | |
/** | |
* Dequeue's theme's custom JS handler, forces jQuery as a dependency. Testing code is commented out below. | |
* | |
* You can add this recipe to your site by creating a custom plugin | |
* or using the Code Snippets plugin available for free in the WordPress repository. | |
* Read this companion article for step-by-step directions on either method. | |
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function my_pmpro_dequeue_script_in_theme() { | |
wp_register_script( 'jquery-js', false, array( 'jquery' ) ); | |
} | |
add_action( 'init', 'my_pmpro_dequeue_script_in_theme' ); | |
/* | |
add_action( | |
'wp_enqueue_scripts', | |
function() { | |
wp_enqueue_script( 'jquery-js', 'https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js' ); | |
} | |
); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment