The “standard” way of processing AJAX requests in WordPress involves using WordPress’ admin AJAX API — whether you’re actually working in the admin or not. For front-end use of AJAX, especially on high-traffic sites, repurposing the admin AJAX API is not a great option. The 10up Engineering Best Practices provides a good breakdown as to why using admin AJAX for the front-end is not a good idea. It points out that using WordPress’ admin AJAX API causes the WordPress admin to be fully bootstrapped and has no built-in caching. For its intended purpose — running the WordPress backend — this […]
Processing Forms with AJAX Using the JSON REST API
Update: For more information, you can download our free ebook, The Ultimate Guide to the WordPress REST API. In this article, I’m going to demonstrate how to write a simple plugin to create and edit posts using the JSON REST API. While this could be the basis of a cool, front-end editing plugin — with the addition of some fields and CSS, and the implementation of the TinyMCE or similar, of course — the point isn’t to reverse the engineering of the WordPress post editor, but rather to introduce you to processing form data using the REST API and AJAX. After you understand how […]
6 Comments