AnsweredAssumed Answered

ArcGIS Javascript API broken after latest WordPress release

Question asked by dhunink on Dec 23, 2014
Latest reply on Jan 19, 2015 by RShirley

SOLUTION: For everyone interested: turned out the solution was moving all files that use DoJo beneath the jQuery UI files, so that jQuery UI is fully loaded before any DoJo stuff loads. Moved them all in the footer in that order (jQuery, then jQuery UI and then alle DoJo related files).

I'm running a Wordpress website which uses both jQuery and the ArcGIS Javascript API v3.12. After recently upgrading from Wordpress 4.0.1 to 4.1, things broke. Dojo is returning multiple Error: multipleDefine errors.

Basically it looks like DoJo tries to load a new instance of jQuery, which it shouldn't, since WordPress has loaded jQuery already and there isn't a jQuery module available in the DoJo map. Furthermore, this issues seems to only exists in WordPress, not in a jsfiddle I made including exactly the same scripts.

For debugging purposes I first disabled all WordPress plugins, without any result; the problem kept existing. I went on and found a couple of interesting things. But I'm really stuck in the further debugging proces. I know the scope of this question is rather broad, but any thoughts at all are very much appreciated.

What I know so far/that i'm wondering about:

-Things stopt working after upgrading to WordPress 4.1

-In the info of the multipleDefine error it states https://js.arcgis.com/3.11/jquery.js, which is weird: it shouldn't be looking for jQuery there, since it's already included in Wordpress

-Things break as soon as I included the ArcGIS Javascript API, which includes DoJO, but only in WordPress; on a jsfiddle things work fine http://jsfiddle.net/dhunink/mry5vn3s/6/

Above leads me to the conclusion that something changed in the last WordPress release that effects my script, although I can't find anything in the release notes that could be linked to my issue.

Any thoughts, suggestions of comments are highly appreciated! Feel free to see all in action at https://tpgrf.nl/testserver/alpha/topotrainer/provincies/.

Outcomes