Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have plugin I would like to use only on the contact page, however the script and css is being loaded on every page. Aside from the increased http requests, it is also causing another script to not work properly on another page.

Is there a way to stop this plugin from loading anywhere else on the site?

I know how to do this with normal scripts in the header, but I am not sure how to do this with a plugin that automatically injects scripts into the header.

Thanks in advance.

share|improve this question
add comment

2 Answers

I have figured it out.

There is a good explanation here.. http://contactform7.com/loading-javascript-and-stylesheet-only-when-it-is-necessary/

You edit the wp.config file with the scripts you wish to not load...

define('WPCF7_LOAD_JS', false);

...and then manually enqueue them on the pages you wish to load the script.

share|improve this answer
add comment

Try using if(is_page('contact-page-slug')){ to add your functions to that page only.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.