Important technical note for WordPress developers


Working with various WordPress websites (freelancing), I noticed something that bothers me for a while :scream:

I have seen a lot of codecanyon plugins and themeforest themes which load all the scripts they need on ALL admin pages. Not only on the page where needed, but on ALL admin pages…One theme doing this is even in top 20 on themeforest, I will not name it :frowning:

Why is this wrong:

Example 1:
For instance, if the theme/plugin loads google maps API on ALL admin pages, even where the theme/plugin doesn’t need it, it will break other map plugins - this is because Google Maps throws an error and doesn’t work if their API is loaded twice on a page.

Example 2:
Just imagine that a theme incorporates a lot of shortcodes…For this, it’s loading various jQuery scripts and jQuery plugins that aren’t loaded by default by WordPress (jquery-ui-dialog, file-upload, pick-a-date, etc). And it’s loading them on ALL admin pages…Why? I don’t now.

Now just imagine that the end user will install other plugins which also load their scripts…

You can imagine how slow the admin pages will be. Not to name the conflicts…

I could give more examples, but here is an article showing one way to do this correctly, it’s applicable both for theme and plugin authors

You can google to find other solutions, but please stop loading your scripts and styles on ALL admin pages! The buyers will thank you in the end! :gift:



Developing an admin interface for WordPress and really wanted to write about this also some time ago. There are many popular plugins doing this so wrong and I’m pretty sure their developers don’t even know about this.

1 Like

greenline, yes! It drives me nuts every time a client tells me “your plugin doesn’t work” - and then I sign-in to his/her WP only to find out some plugin which loads all its script to all admin pages. Which leads to conflicts with my JS scripts. What were those developers thinking about? It think CodeCanyon and ThemeForest should make a strict rule about that problem and don’t accept plugin/themes violating it.

1 Like