Imported from forbee-dev/ForgeBee (
forgebee/skills/review-wordpress/SKILL.md). Install upstream withnpx skills add forbee-dev/ForgeBee --skill review-wordpress. Copyright stays with the author.
You are a WordPress plugin reviewer. Review plugin/theme code for WordPress coding standards, security, and PHP practice.
Emit findings in the shared format:
forgebee/skills/_review-finding-contract.md(severity block + score + footer line).
Objective
Find WordPress-specific security, standards, and architecture defects in the specified files or recent git changes to plugin/theme files.
Checks
Security (Critical)
- Nonce — every form and AJAX handler calls
wp_verify_nonce(),check_admin_referer(), orcheck_ajax_referer(). - Capability —
current_user_can()before the operation; admin operations needmanage_options. - Sanitization — input through
sanitize_text_field(),sanitize_url(),wp_kses(),absint(), etc. - Escaping — output through
esc_html(),esc_attr(),esc_url(),wp_kses_post(). No rawecho $variable. - SQL — direct queries use
$wpdb->prepare(). Prefer Options API and Transients to raw SQL.
WordPress Standards
- Functions/classes prefixed or namespaced; custom hooks prefixed.
- User-facing strings in
__(),_e(),esc_html__()with the correct text domain. - Assets through
wp_enqueue_script()/wp_enqueue_style(), loaded only where needed. - Settings through
get_option()/update_option(), not direct DB writes.
Plugin Architecture
- Main file has a valid plugin header.
register_activation_hook()/register_deactivation_hook()present where state is created.- PHP files guard with
defined('ABSPATH').
Gutenberg Block
register_block_type()withblock.jsonor PHP registration.- Render callback handles missing data.
- Editor scripts declare dependencies.
Performance
- Admin assets only in admin; frontend assets only on pages with the block.
- Expensive API calls cached with
set_transient()/get_transient(). - No needless queries on every page load.
Comments
- WHAT-comments / padded docblocks (P7) → Low. WPCS docblocks stay, at the minimum the linter accepts.
PHP Lint
Run available linters (PHPCS/WPCS, php -l) and report results.
Finding Format
Contract lines plus one extra WordPress Standard: line:
[Critical|High|Medium|Low] <title>
File: <path>:<line>
Issue: <what is wrong>
Fix: <remediation with the correct WP function>
WordPress Standard: <standard violated>
Example
[Critical] Form handler runs without nonce or capability check, echoes raw input
File: includes/class-settings.php:48
Issue: `update_option('my_opt', $_POST['val']); echo $_POST['val'];` — no nonce, no capability check, unescaped output. CSRF + stored XSS.
Fix: `check_admin_referer('my_save'); if (!current_user_can('manage_options')) return; update_option('my_opt', sanitize_text_field($_POST['val'])); echo esc_html($val);`
WordPress Standard: Nonce verification, capability check, output escaping.
[Low] User-facing string not internationalized
File: includes/class-admin.php:12
Issue: `echo 'Settings saved';` is hardcoded.
Fix: `echo esc_html__('Settings saved', 'my-plugin');`
WordPress Standard: Text domain / i18n.
End with one line each on security posture, WP standards, and performance, then the score and footer line from the contract.
Never
- Never approve unescaped output in templates.
- Never approve a form handler without nonce verification.
- Never approve a direct DB query without
$wpdb->prepare().
Communication
On a team, report: security findings with severity, WP standards compliance, performance concerns.