Title: CF7 scripts and styles not loading
Last modified: May 28, 2021

---

# CF7 scripts and styles not loading

 *  [mjh1](https://wordpress.org/support/users/mjh1/)
 * (@mjh1)
 * [5 years ago](https://wordpress.org/support/topic/cf7-scripts-and-styles-not-loading/)
 * We have about 20 client sites where we’re loading the CF7 scripts and styles 
   only on pages with a form using the functions.php method described on the following
   page:
 * [https://contactform7.com/loading-javascript-and-stylesheet-only-when-it-is-necessary/](https://contactform7.com/loading-javascript-and-stylesheet-only-when-it-is-necessary/)
 * This broke in a recent plugin update and the CF7 scripts and styles are no longer
   loading at all.
 * What changed? Is this method still possible?

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Takayuki Miyoshi](https://wordpress.org/support/users/takayukister/)
 * (@takayukister)
 * [5 years ago](https://wordpress.org/support/topic/cf7-scripts-and-styles-not-loading/#post-14496657)
 * Where can we see the websites in question?
 *  Thread Starter [mjh1](https://wordpress.org/support/users/mjh1/)
 * (@mjh1)
 * [5 years ago](https://wordpress.org/support/topic/cf7-scripts-and-styles-not-loading/#post-14508198)
 * Here’s an example:
 * [https://theudlapproach.com/contact/](https://theudlapproach.com/contact/)
    -  This reply was modified 5 years ago by [mjh1](https://wordpress.org/support/users/mjh1/).
 *  Plugin Author [Takayuki Miyoshi](https://wordpress.org/support/users/takayukister/)
 * (@takayukister)
 * [5 years ago](https://wordpress.org/support/topic/cf7-scripts-and-styles-not-loading/#post-14510771)
 * What other plugins and theme do you use on the site?
 *  Thread Starter [mjh1](https://wordpress.org/support/users/mjh1/)
 * (@mjh1)
 * [5 years ago](https://wordpress.org/support/topic/cf7-scripts-and-styles-not-loading/#post-14512690)
 * We developed the theme, which is very simple. The theme has been tested with 
   Theme Check.
 * Plugins:
    Classic Editor Honeypot for Contact Form 7 Podbean Shortcode Toggle
   wpautop Wordfence Yoast SEO
 * The relevant part of the functions.php file looks like this:
 *     ```
       add_filter( 'wpcf7_load_js', '__return_false' );
       add_filter( 'wpcf7_load_css', '__return_false' );
   
       function loui_lord_nelson_scripts() {
       	wp_enqueue_style( 'loui-lord-nelson-google-fonts', 'https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700,700i', false );
       	wp_enqueue_style( 'loui-lord-nelson-main-styles', get_template_directory_uri() . '/css/main.css', array(), null );
   
       	if(is_page( 15 )) {
       		wp_enqueue_style( 'loui-lord-nelson-form-styles', get_template_directory_uri() . '/css/forms.css', array(), null );
       		if ( function_exists( 'wpcf7_enqueue_scripts' ) ) {
       		  wpcf7_enqueue_scripts();
       		}
   
       		if ( function_exists( 'wpcf7_enqueue_styles' ) ) {
       		  wpcf7_enqueue_styles();
       		}
       	}
       }
       add_action( 'wp_enqueue_scripts', 'loui_lord_nelson_scripts', 1 );
       ```
   
    -  This reply was modified 5 years ago by [mjh1](https://wordpress.org/support/users/mjh1/).
 *  Plugin Author [Takayuki Miyoshi](https://wordpress.org/support/users/takayukister/)
 * (@takayukister)
 * [5 years ago](https://wordpress.org/support/topic/cf7-scripts-and-styles-not-loading/#post-14514067)
 * > This broke in a recent plugin update and the CF7 scripts and styles are no 
   > longer loading at all.
 * That is because you disable loading of the script and style here:
 *     ```
       add_filter( 'wpcf7_load_js', '__return_false' );
       add_filter( 'wpcf7_load_css', '__return_false' );
       ```
   
 * It is working as intended.
 *  Thread Starter [mjh1](https://wordpress.org/support/users/mjh1/)
 * (@mjh1)
 * [5 years ago](https://wordpress.org/support/topic/cf7-scripts-and-styles-not-loading/#post-14517813)
 * And I’m enabling the scripts and styles again on just the Contact page here:
 *     ```
       	if(is_page( 15 )) {
       		wp_enqueue_style( 'loui-lord-nelson-form-styles', get_template_directory_uri() . '/css/forms.css', array(), null );
       		if ( function_exists( 'wpcf7_enqueue_scripts' ) ) {
       		  wpcf7_enqueue_scripts();
       		}
   
       		if ( function_exists( 'wpcf7_enqueue_styles' ) ) {
       		  wpcf7_enqueue_styles();
       		}
       	}
       ```
   
 * This was working until recently, as I mentioned in my first post. Did something
   change with regard to enqueueing?
 *  Plugin Author [Takayuki Miyoshi](https://wordpress.org/support/users/takayukister/)
 * (@takayukister)
 * [5 years ago](https://wordpress.org/support/topic/cf7-scripts-and-styles-not-loading/#post-14518693)
 * See [Loading JavaScript and stylesheet only when it is necessary](https://contactform7.com/loading-javascript-and-stylesheet-only-when-it-is-necessary/)
   and follow the steps in the post.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘CF7 scripts and styles not loading’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Takayuki Miyoshi](https://wordpress.org/support/users/takayukister/)
 * Last activity: [5 years ago](https://wordpress.org/support/topic/cf7-scripts-and-styles-not-loading/#post-14518693)
 * Status: not resolved