0 comments on “WordPress & JavaScript “Admin Edition””

WordPress & JavaScript “Admin Edition”

WordPress does some odd things when it comes to managing the DOM elements, especially when it comes to JavaScript and CSS. WordPress has crafted their own creative PHP methodology for getting data from PHP into JavaScript when loading the scripts. This allows for JavaScript variables to be “pre-initialized” when the scripts are first rendered.

Useful for getting a known starting state in JavaScript based on PHP state and logic that has run up to the point that the scripts are loaded.

Not standard AT ALL given today’s single page app and other advanced methodologies just as REST queries, etc. that could do the same job.