Issue Description
The document that describes how to use AJAX in WordPress only refers to the old admin AJAX API, and not only doesn't describe AJAX with the REST API, but doesn't mention its existence. The REST API is a surprise for most users trying to debug AJAX, even though debugging with the REST API gives you human readable error messages where Admin AJAX prints 0
URL of the Page with the Issue
https://developer.wordpress.org/plugins/javascript/ajax/
Section of Page with the issue
Entire page
Why is this a problem?
While we shouldn't be encouraging the use of an older more difficult API, we should at the very least mention that a newer API exists
Suggested Fix
One of the following:
- mention the REST API at the top and note that the document talks about
admin-ajax.php which is an older API
- rewrite the doc to work the same way but with a REST API endpoint via
register_rest_route
- add both REST API and Admin AJAX API examples
Issue Description
The document that describes how to use AJAX in WordPress only refers to the old admin AJAX API, and not only doesn't describe AJAX with the REST API, but doesn't mention its existence. The REST API is a surprise for most users trying to debug AJAX, even though debugging with the REST API gives you human readable error messages where Admin AJAX prints
0URL of the Page with the Issue
https://developer.wordpress.org/plugins/javascript/ajax/
Section of Page with the issue
Entire page
Why is this a problem?
While we shouldn't be encouraging the use of an older more difficult API, we should at the very least mention that a newer API exists
Suggested Fix
One of the following:
admin-ajax.phpwhich is an older APIregister_rest_route