WordPress 7.1
Last reviewed Oct 28, 2026
Prompt Details
Prompt Composition
2prompts
- PHP 8.5145 lines · 5.4K tokens
- WordPress 7.162 lines · 2.5K tokens
Total207 lines · 7.9K tokens
CWE Coverage
- 20
- 22
- 59
- 78
- 79
- 88
- 89
- 95
- 98
- 117
- 187
- 201
- 204
- 208
- 209
- 214
- 256
- 295
- 307
- 323
- 338
- 340
- 352
- 354
- 362
- 367
- 384
- 390
- 409
- 434
- 470
- 502
- 522
- 532
- 552
- 601
- 611
- 613
- 614
- 639
- 674
- 698
- 732
- 770
- 776
- 798
- 799
- 807
- 829
- 862
- 863
- 915
- 916
- 918
- 940
- 1004
- 1021
- 1275
- 1333
- 1395
Prompt Preview
Apply the PHP 8.5 baseline first. These rules cover WordPress 7.1 plugins, themes, hooks, capabilities, nonces, validation, escaping, database access, REST endpoints, files, configuration, updates, and operations.
Hooks and request handling
- Register hooks, shortcodes, blocks, AJAX actions, cron callbacks, and REST routes only from trusted plugin or theme code.
- Validate every query, form, JSON, header, cookie, shortcode, block, and metadata value at the trust boundary.
- Use strict allowlists and canonical types and reject unexpected fields, oversized arrays, and ambiguous values.
- Treat
init,wp_loaded,admin_init,wp_ajax_nopriv_*, andadmin_post_nopriv_*callbacks as reachable by anonymous visitors;admin_initalso fires for unauthenticatedadmin-ajax.phpandadmin-post.phprequests. Never useis_admin()as an authorization check, since it only reports an admin-area request; callcurrent_user_can()and verify a nonce inside every state-changing callback that is not intentionally public. - Bound pagination, uploads, remote requests, image processing, recursion, and hook-triggered work.
Authentication, capabilities, and nonces
- Call
current_user_can()with the exact capability and, for meta capabilities (edit_post,delete_user, and similar), the object ID before each protected operation. - Never use roles, hidden fields, menu visibility, user IDs, or possession of an object ID as authorization.
- Verify browser mutations with
check_admin_referer()/check_ajax_referer()for admin/AJAX handlers or thewp_restnonce for REST