Paste a PHP snippet before it goes on a site and see the risky patterns in it: code execution, unsanitized request data, SQL built without prepare(), handlers with no nonce or capability check, open REST routes and keys left in the code. Each finding comes with the line, why it matters and the fix.
The checker needs JavaScript. For the same checks by hand, see the questions below.
What it checks
- Code execution:
eval(),create_function(),assert()on variables,preg_replace()with/e, and decoded blobs fed into any of them. - Shell and files:
exec(),shell_exec(), backticks, includes from variable paths, and file writes or deletes driven by request data. - Request data:
$_GET,$_POST,$_REQUEST,$_COOKIEand$_SERVERused without sanitizing, printed without escaping, or used in redirects and outgoing requests. - Database:
$wpdbqueries built from variables without$wpdb->prepare(). - Handlers:
wp_ajax_andadmin_post_handlers with no nonce or capability check, publicwp_ajax_nopriv_actions, and REST routes whosepermission_callbacklets anyone in. - Other:
unserialize()on variables,extract()on request data, and strings that look like API keys.
Questions
Does a clean result mean the snippet is safe?
No. This is a pattern check: it reads the code line by line and can’t see what the code does at runtime, what a function you call does, or whether a value was sanitized somewhere else. Treat findings as places to look, and a clean result as a good sign.
Is what I paste sent anywhere?
No. The checker runs entirely in your browser. Nothing is uploaded or stored.
How do I fix “request data used without sanitizing”?
Unslash and sanitize when you read the value, for the type you expect: sanitize_text_field( wp_unslash( $_POST['name'] ?? '' ) ) for text, absint() for IDs, sanitize_email() for email addresses. Then escape again when you print it, with esc_html(), esc_attr() or esc_url().
What should an AJAX or admin-post handler always check?
A nonce (check_ajax_referer() or check_admin_referer()) so another site can’t trigger it, and a capability (current_user_can()) so a subscriber can’t run an admin action. Public wp_ajax_nopriv_ handlers still need a nonce and should never do anything privileged.
Building Gravity Forms sites? Browse our free Gravity Forms code snippet library.