Last active
April 14, 2018 12:21
-
-
Save BluePraise/ef02a2fd853c158bd5fc to your computer and use it in GitHub Desktop.
Remove Contactform7 scripts from WP pages
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
// Put this script in your functions.php | |
// I have very little pages, and I am sure it can be improved | |
// or adjusted to suit your own project. | |
//Deregister the scripts. | |
function deregister_contact_form() { | |
// You can put here all the pages where there is no contact form | |
if ( ! is_page( 'contact' ) ) { | |
remove_action('wp_enqueue_scripts', 'wpcf7_enqueue_scripts'); | |
} | |
} | |
//Add the action. | |
add_action( 'wp', 'deregister_contact_form'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment