Ajax Security

Use when registering or handling WordPress AJAX over admin-ajax.php - wp_ajax_{action} / wp_ajax_nopriv_{action} hooks, JavaScript that posts to admin_url('admin-ajax.php'), or wp.apiFetch / fetch calls to custom actions. Verifies the nonce with check_ajax_referer, gates the action with current_user_can, unslashes and sanitizes every field, and replies with wp_send_json_success / wp_send_json_error. Prevents CSRF, broken access control, and injection on the AJAX surface.

wpultimatesecurity 0a9a77b 3 files · 16.0 KB Updated

File contents

wpultimatesecurity/WordPress-Security-Skills/tree/main/skills/ajax-security commit 0a9a77b27d

Frequently asked questions

npx skillmds@latest add wpultimatesecurity/ajax-security