Speed Up Contact Form 7 Plugin For WordPress
Note: Google said site speed is a factor. Contact Form 7 plugin for WordPress is quite bulky in terms of external scripts it’s loads.
You can speed up how fast Contact Form 7 loads (by loads) by ensuring the associated javascript files load ONLY on the contact form itself.
Quickly optimise your contact form 7 wordpress plugin by just adding the following code to the end of your functions.php – you can take 70kb off your load time.
NOTE: Be sure to wrap the following in PHP tags in the example illustrated below:
add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );function my_deregister_javascript() {if ( !is_page('Contact') ) {wp_deregister_script( 'contact-form-7' );}}add_action( 'wp_print_styles', 'my_deregister_styles', 100 );function my_deregister_styles() {if ( !is_page('Contact') ) {wp_deregister_style( 'contact-form-7' );}}
Written by Robert McKenzie