Opened 6 years ago
Last modified 6 days ago
#49408 new enhancement
Why is the action wp_ajax_wp_link_ajax not using wp_send_json()
| Reported by: | stephanh | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | General | Version: | 5.3.2 |
| Severity: | normal | Keywords: | has-patch needs-testing has-unit-tests |
| Cc: | Focuses: | coding-standards |
Description
The action now returns an array with results with the header content-type text/html
Should this not be application/json as achieved by the wp_send_json() function?
https://core.trac.wordpress.org/browser/tags/5.3.2/src/wp-admin/includes/ajax-actions.php#L1863
Attachments (1)
Change History (4)
This ticket was mentioned in PR #12832 on WordPress/wordpress-develop by @arkaprabhachowdhury.
6 days ago
#3
- Keywords has-unit-tests added
## Summary\n\n- Use wp_send_json() for wp_ajax_wp_link_ajax() responses.\n- Add regression coverage for the JSON content type and response payload.\n\nTrac: https://core.trac.wordpress.org/ticket/49408\n\n## Testing\n\n- PHPCBF\n- PHPCS\n- PHP syntax checks\n- PHPUnit blocked locally because the Docker MySQL host is unavailable.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
This could use some testing by someone who understands it better than I do :)
Next time, please create a patch from the root directory, but 49408.patch does apply to src.
The code for the
wp_ajax_wp_link_ajaxwas added in 3.1 (changeset:16459), andwp_send_jsonwas created for 3.5. So that's likely why it is not used yet.