Created
June 17, 2025 10:57
-
-
Save xlplugins/678f1f20eb126d3031b273636bfae617 to your computer and use it in GitHub Desktop.
Dequeue_wp_forms_js_on_optin
This file contains hidden or 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
/** | |
* Dequeues the `wpforms-smart-phone-field` script on optin pages. | |
* | |
* This function hooks into the `wp_enqueue_scripts` action and checks if the current page | |
* is an optin page using the `WFFN_Optin_Pages` class. If the page is an optin page, it | |
* removes the `wpforms-smart-phone-field` script from the queue. | |
* | |
* @hook wp_enqueue_scripts | |
* @priority 20 | |
*/ | |
add_action( 'wp_enqueue_scripts', function() { | |
// Check if the current page is an optin page. | |
if ( class_exists( 'WFFN_Optin_Pages' ) && WFFN_Optin_Pages::get_instance()->is_wfop_page() ) { | |
// Dequeue the wpforms-smart-phone-field script. | |
wp_dequeue_script( 'wpforms-smart-phone-field' ); | |
} | |
}, 9999999 ); // Priority set to 20 to ensure it runs after scripts are enqueued. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment