0

Scripts and Styles like bootstrap and font awesome are used on hundreds/thousands of plugins.

Whats the best way to check for this? If two scripts aren't registered with exact same name they'll both get loaded.

This is most frustrating when a plugin includes font-icons from ico-moon or somewhere similar that change the icon codes so all the icons will get loaded with the wrong images.

Is there a good way to remove adding scripts/styles? :

My guess would be something like using wp_script_is() and checking an array of files that would match ones like bootstrap and font awesome, but that sounds pretty heavy/ tedious.

If there isn't a way to ensure this doesn't happen, what is the best practices for naming your scripts?

Sorry if this is repeat, it seems like something that's probably been asked just couldn't find it.

2
  • There is no way to do that. Because theme or plugin developer can include these with theme/plugin files or he can directly link to one of dozon CDNs that host these scripts.
    – Robert hue
    Sep 10 '14 at 15:57
  • 1
    This question can be rephrased as: "Bob and Alice are about to say something. If they say the same thing, bad things will happen. They have never met. You can not change what they are about to say. How do I make sure they don't say the same thing?"
    – Tom J Nowell
    Sep 10 '14 at 16:20
1

You can't. Short of developing community standards it cannot be done, and community standards are useless if the other developer ignores or is unaware of them. There is no foolproof reliable solution short of enumerating every conceivable bootstrap or font awesome combination then scanning for them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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