/major-ai-skills:wordpressfrom major-ai-skills
Build and harden WordPress themes/plugins with escape-on-output, capability+nonce gates, prepared SQL, REST permission_callback, and WP-CLI-safe cutovers—security failures agents routinely ship.
Ships in major-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
WordPress serves content via themes + plugins on PHP + MySQL. Behavior extends through actions/filters, custom post types, and the REST API. WP-CLI drives installs, search-replace, and cron without the browser. Agents sanitize on input / escape on output, use $wpdb->prepare or WP APIs, require current_user_can + nonces (nonces alone are not auth), always set REST permission_callback, and never commit wp-config.php secrets or edit core files.
┌─────────────────────────────────────────────────────────────┐
│ WordPress request → response │
│ │
│ Client → @nginx / Apache → PHP-FPM │
│ → WP core bootstrap (wp-config secrets at runtime) │
│ → Active theme + plugins (actions / filters) │
│ ├── WP_Query / $wpdb → MySQL │
│ ├── REST (/wp-json) + permission_callback │
│ └── admin-ajax / cron / WP-CLI │
│ │
│ Security gates │
│ ├── Escape output; prepare SQL; capability checks │
│ └── Nonces = CSRF only (not authorization) │
└─────────────────────────────────────────────────────────────┘
Use when
Do not use when
@nginx / @nginx-hardening.@owasp-asvs.wp-config.php → refuse.esc_html, esc_attr, esc_url, wp_kses_post); sanitize on input (sanitize_text_field, absint, etc.).$wpdb->prepare for dynamic SQL; prefer WP_Query / Metadata API when possible.current_user_can (object-aware when needed). Nonces are CSRF only—never treat nonce presence as login/auth.check_admin_referer / wp_verify_nonce patterns.register_rest_route needs permission_callback. Use __return_true only for genuinely public data; otherwise current_user_can(...).wp_enqueue_script / wp_enqueue_style; localize nonces via wp_localize_script / wp_add_inline_script—do not hardcode secrets in JS.DISALLOW_FILE_EDIT, keep core/themes/plugins updated, remove unused plugins, prefer env/server config for secrets outside web root (Bedrock-style when applicable).--dry-run first; then apply; flush caches; verify URLs/HTTPS.wp-config placeholders.Plugin sketch:
<?php
/**
* Plugin Name: Example Books
*/
add_action('init', function () {
register_post_type('book', [
'public' => true,
'label' => 'Books',
'show_in_rest' => true,
'supports' => ['title', 'editor', 'thumbnail'],
]);
});
add_action('rest_api_init', function () {
register_rest_route('example-books/v1', '/settings', [
'methods' => 'POST',
'callback' => 'example_books_update_settings',
'permission_callback' => function () {
return current_user_can('manage_options');
},
'args' => [
'title_prefix' => [
'required' => true,
'sanitize_callback' => 'sanitize_text_field',
],
],
]);
});
function example_books_update_settings(WP_REST_Request $request) {
$prefix = $request->get_param('title_prefix');
update_option('example_books_title_prefix', $prefix);
return ['ok' => true, 'title_prefix' => $prefix];
}
add_action('admin_post_example_books_save', function () {
if (!current_user_can('manage_options')) {
wp_die(esc_html__('Forbidden', 'example-books'), 403);
}
check_admin_referer('example_books_save');
$val = isset($_POST['title_prefix'])
? sanitize_text_field(wp_unslash($_POST['title_prefix']))
: '';
update_option('example_books_title_prefix', $val);
wp_safe_redirect(admin_url('options-general.php?page=example-books'));
exit;
});
wp-config.php production flags (values from env—do not invent secrets):
define('DISALLOW_FILE_EDIT', true);
define('FORCE_SSL_ADMIN', true);
// define('WP_DEBUG', false); in production
WP-CLI cutover:
wp search-replace 'http://old.example' 'https://new.example' --all-tables --dry-run
wp search-replace 'http://old.example' 'https://new.example' --all-tables
wp rewrite flush --hard
wp cache flush
wp plugin list --status=active
wp core verify-checksums
| Signature | Likely cause | Fix path |
|---|---|---|
| Stored XSS in admin/front | Echoed unsanitized $_GET/the_content mishandled | Escape/kses on output; sanitize on save |
SQL injection / odd $wpdb errors | String-concat SQL | $wpdb->prepare or WP APIs |
rest_forbidden / _doing_it_wrong permission | Missing or wrong permission_callback | Explicit callback; cookie + X-WP-Nonce for cookie auth |
| CSRF on settings save | No nonce / capability | check_admin_referer + current_user_can |
| Broken site after domain change | Serialized URL replace by naive sed | WP-CLI search-replace (PHP-aware) |
| White screen after plugin update | Fatal in plugin; memory | WP_DEBUG_LOG; disable via WP-CLI; raise memory carefully |
| admin-ajax abuse / DoS | Public unlimited handlers | Capability checks, nonces, rate limits |
| Edits lost on upgrade | Core/theme file hacks | Child theme / plugin hooks only |
wp_options autoload bloat.@nginx hardening: deny PHP in uploads, correct client_max_body_size, HTTPS redirects.@nginx — reverse proxy and PHP-FPM fronting@nginx-hardening — origin TLS and upload/PHP deny rules@owasp-asvs — broader application security requirements@lets-encrypt — certificate issuance interacting with the hostMANDATORY: Escape on output; prepare SQL; gate every state change with capability checks—nonces alone are not authorization. Every REST route needs an explicit
permission_callback. Never edit core, never commit secrets, always--dry-runWP-CLI search-replace before apply.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub alivirgo/major-ai-skills --plugin major-ai-skills412 skills in this plugin
/3d-slicerAutomate 3D Slicer research workflows with MRML, VTK/ITK, DICOM data, and Segment Editor. Use for software workflows, not clinical interpretation./abbreviated-git-statusInspect Git branch, staging, and working-tree changes with short or porcelain status output when a compact repository check is needed./ableton-liveAutomate Ableton Live sessions with Python MIDI Remote Scripts, Max for Live, AbletonOSC, and Link synchronization./act-as-a-personal-tutorExplain a subject step by step, assess prior knowledge, and use short exercises to check understanding before advancing.Other plugins' skills for the same job