Last active
February 24, 2026 22:50
-
-
Save rickalday/d6b06706e30f5eaaceaba007a0eede9d to your computer and use it in GitHub Desktop.
Removes all GiveWP Styles and Scripts
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
| function give_mysite_deregister_script() { | |
| $deregister = false; | |
| // Deregister on the homepage. | |
| if ( is_home() || is_front_page() ) { | |
| $deregister = true; | |
| } elseif ( is_page( 12 ) ) { | |
| //Deregister for a specific page. | |
| $deregister = true; | |
| } | |
| // Check if the conditions are met to register. | |
| if ( $deregister ) { | |
| remove_all_givewp_styles_scripts(); | |
| } | |
| } | |
| add_action( 'wp_print_scripts', 'give_mysite_deregister_script', 100 ); | |
| add_action( 'wp_enqueue_scripts', 'give_mysite_deregister_script', 100 ); | |
| function remove_all_givewp_styles_scripts() { | |
| global $wp_scripts; | |
| global $wp_styles; | |
| foreach( $wp_scripts->queue as $handle ) { | |
| if (strpos($wp_scripts->registered[$handle]->handle, 'give') !== false) { | |
| wp_dequeue_script( $handle ); | |
| } | |
| } | |
| foreach( $wp_styles->queue as $handle ) { | |
| if (strpos($wp_styles->registered[$handle]->handle, 'give') !== false) { | |
| wp_dequeue_style( $handle ); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment