Tag Info

New answers tagged


the_content filter is (most likely) running long after you scripts were output. You need to either: Run localize logic earlier. Enqueue scripts for footer, using respective wp_enqueue_script() argument.


TL;DR There is no JavaScript API in the WordPress core and no one is planned, but actually, there is no need of it. Backend First of all let's say that, regarding the backend, some useful information can be fetched from already present JavaScript global variables (WordPress loves all global flavors). E.g. ajaxurl for the admin-ajax.php url to be used ...


To answer your statement: [...] there is no built-in Javascript API for Wordpress. Therefore developers who want to build on Ajax seem to come up all with their own solution which doesn't seem right to me. There is no "own solution" to be done. You can ease things by using ATP with ajax_template_part() by @G.M. or similar plugins and take a short cut, ...


While historically WP has been backā€“end centric, there had been declaration made for years now about moving towards heavy JS use. With backwards compatibility commitments in mind it is questionable that JS will achieve parity or take over PHP any time soon (in my opinion), but there had been some progress on it. The WordPress admin now ships with Backbone ...


There has been quite a bit of development around the JSON REST API that is supposed to be merged into the 4.1 release. I believe it's officially going to be called the 'WP API'. You can begin using the codebase now and keep up with the latest developments here until it gets to core. Ryan McCue and team have fleshed out some pretty good documentation here.

Top 50 recent answers are included