Scripts & Style Sheets only used on required pages.

Posted on 2014-02-12
Medium Priority
Last Modified: 2014-02-13
Some of my wordpress websites have many plugins which generate lots of links to Scripts & Style Sheets.

Some of these Scripts & Style Sheets are only required on one page however Wordpress links to them on every page usually via the header.

Does anyone know of a method or plugin to restrict Scripts & Style Sheets used only the ones used on the relevant page?
Question by:petewinter
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 70

Expert Comment

by:Jason C. Levine
ID: 39854374
How is the "relevant page" to be determined?  All WordPress knows is that you have installed something.

Author Comment

ID: 39854413
Open to idea's. Can it be done via template?
LVL 70

Expert Comment

by:Jason C. Levine
ID: 39854573
Sort of.  The issue is that the plugins are the ones adding the calls to the files so any solution involving conditional code would probably involve altering the plugin.  Once you do that, you either have to fork it or not update it as the next update will blow away any changes.
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 83

Expert Comment

by:Dave Baldwin
ID: 39854932
Why do you want to do this?  What is your goal?

Author Comment

ID: 39855453
I want to reduce calls and help page speed
LVL 70

Accepted Solution

Jason C. Levine earned 2000 total points
ID: 39855461
The better way to do this may be to minify and combine CSS and JS files.  W3 Total Cache can do it or you can hook onto a CDN service that will do it too.

Author Closing Comment

ID: 39855602
Okay. Thanks for the advice

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question