I would like to disable the load of jQuery when it comes to the page that SiteOrigin is in action. In my case, there is an issue when loading:
because its loading twice jQuery.
How can i prevent SiteOrigin to load jquery?
Thanks!
I would like to disable the load of jQuery when it comes to the page that SiteOrigin is in action. In my case, there is an issue when loading:
because its loading twice jQuery.
How can i prevent SiteOrigin to load jquery?
Thanks!
This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.
Hi David
Thanks for reaching out.
Have you made progress since posting? I’m only seeing jQuery loaded once on the linked page.
Hi Andrew,
in my header-bundle.js i have jquery and its only in the link that i send that is added jquery and other scripts at the bottom of the page (if you see the source code of the home vs the one from the entry with SiteOrigin plugin, you can see that its added the extra jquery). So my idea is to disable that jquery with a hook/action?
Thanks!
Thanks for the update.
Is the duplicate jQuery file visible in the source code of the page in question? I can only see jQuery being loaded once on line 438.
If you use
view-source:https://www.darbys-london.com/journal/oyster/
in your address bar the line numbers will be listed.Hi Andrew,
yeah, that one is the one i want to remove from loading since i am already loading jQuery in line 11 (header-bundle.js?ver=5.2.6 is loading in one file multiple libraries).
Is that possible? can i prevent with a hook in functions.php SiteOrigin to add the jQuery at the end of the document?
Thanks!
Thanks.
Page Builder loads jQuery by specifying jQuery as a dependency. You could do the same by listing jQuery as a dependency when enqueuing your theme’s JS file. Doing so would ensure the core WP jQuery version is used on other pages. Here is an example of that: https://github.com/siteorigin/siteorigin-corp/blob/develop/functions.php#L194
Ref: https://developer.wordpress.org/reference/functions/wp_enqueue_script/
Doing it this way might avoid potential issues in the future.
Page Builder’s dependency is declared as follows https://github.com/siteorigin/siteorigin-panels/blob/1f2b6e76a4d5559c114a115d18c865b946b732f9/inc/styles.php#L54.
You can perhaps try something like:
Ideally, the function should be namespaced, for example instead of
remove_jquery
, if this were in SiteOrigin Corp theme we’d usesiteorigin_corp_remove_jquery
.Perfect Andrew! I will check this action you mention, i think is what i was looking for.
Thank you very much for your help!
Sure, no problem, let us know how it goes.
Andrew!
When adding the action, it also removes some other scripts, for example the one from the player that makes it responsive.
Any suggestions?
Hi David
Thanks for your feedback.
We’re a bit beyond our normal free support scope with this task. Is the version of jQuery in your theme JS file different from the core version? Are you sure you don’t want to enqueue your theme JS file with jQuery as a dependency? It would sort this all out.