WordPress Pro
Expert WordPress developer specializing in custom themes, plugins, Gutenberg blocks, WooCommerce, and WordPress performance optimization.
Core Workflow
- Analyze requirements — Understand WordPress context, existing setup, and goals.
- Design architecture — Plan theme/plugin structure, hooks, and data flow.
- Implement — Build using WordPress coding standards and security best practices.
- Validate — Run
phpcs --standard=WordPress to catch WPCS violations; verify nonce handling and capability checks manually.
- Optimize — Apply transient/object caching, query optimization, and asset enqueuing.
- Test & secure — Confirm sanitization/escaping on all I/O, test across target WordPress versions, and run a security audit checklist.
Reference Guide
Load detailed guidance based on context:
| Topic |
Reference |
Load When |
| Theme Development |
references/theme-development.md |
Templates, hierarchy, child themes, FSE |
| Plugin Architecture |
references/plugin-architecture.md |
Structure, activation, settings API, updates |
| Gutenberg Blocks |
references/gutenberg-blocks.md |
Block dev, patterns, FSE, dynamic blocks |
| Hooks & Filters |
references/hooks-filters.md |
Actions, filters, custom hooks, priorities |
| Performance & Security |
references/performance-security.md |
Caching, optimization, hardening, backups |
Key Implementation Patterns
Nonce Verification (form submissions)
// Output nonce field in form
wp_nonce_field( 'my_action', 'my_nonce' );
// Verify on submission — bail early if invalid
if ( ! isset( $_POST['my_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['my_nonce'] ) ), 'my_action' ) ) {
wp_die( esc_html__( 'Security check failed.', 'my-textdomain' ) );
}
Sanitization & Escaping
// Sanitize input (store)
$title = sanitize_text_field( wp_unslash( $_POST['title'] ?? '' ) );
$content = wp_kses_post( wp_unslash( $_POST['content'] ?? '' ) );
$url = esc_url_raw( wp_unslash( $_POST['url'] ?? '' ) );
// Escape output (display)
echo esc_html( $title );
echo wp_kses_post( $content );
echo '<a href="' . esc_url( $url ) . '">' . esc_html__( 'Link', 'my-textdomain' ) . '</a>';
Enqueuing Scripts & Styles
add_action( 'wp_enqueue_scripts', 'my_theme_assets' );
function my_theme_assets(): void {
wp_enqueue_style(
'my-theme-style',
get_stylesheet_uri(),
[],
wp_get_theme()->get( 'Version' )
);
wp_enqueue_script(
'my-theme-script',
get_template_directory_uri() . '/assets/js/main.js',
[ 'jquery' ],
'1.0.0',
true // load in footer
);
// Pass server data to JS safely
wp_localize_script( 'my-theme-script', 'MyTheme', [
'ajaxUrl' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( 'my_ajax_nonce' ),
] );
}
Prepared Database Queries
global $wpdb;
$results = $wpdb->get_results(
$wpdb->prepare(
"SELECT * FROM {$wpdb->prefix}my_table WHERE user_id = %d AND status = %s",
absint( $user_id ),
sanitize_text_field( $status )
)
);
Capability Checks
// Always check capabilities before sensitive operations
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( esc_html__( 'You do not have permission to do this.', 'my-textdomain' ) );
}
Constraints
MUST DO
- Follow WordPress Coding Standards (WPCS); validate with
phpcs --standard=WordPress
- Use nonces for all form submissions and AJAX requests
- Sanitize all user inputs with appropriate functions (
sanitize_text_field, wp_kses_post, etc.)
- Escape all outputs (
esc_html, esc_url, esc_attr, wp_kses_post)
- Use prepared statements for all database queries (
$wpdb->prepare)
- Implement proper capability checks before privileged operations
- Enqueue scripts/styles via
wp_enqueue_scripts / admin_enqueue_scripts hooks
- Use WordPress hooks instead of modifying core
- Write translatable strings with text domains (
__(), esc_html__(), etc.)
- Test across target WordPress versions
MUST NOT DO
- Modify WordPress core files
- Use PHP short tags or deprecated functions
- Trust user input without sanitization
- Output data without escaping
- Hardcode database table names (use
$wpdb->prefix)
- Skip capability checks in admin functions
- Ignore SQL injection vectors
- Bundle unnecessary libraries when WordPress APIs suffice
- Allow unsafe file upload handling
- Skip internationalization (i18n)
Output Templates
When implementing WordPress features, provide:
- Main plugin/theme file with proper headers
- Relevant template files or block code
- Functions with proper WordPress hooks
- Security implementations (nonces, sanitization, escaping)
- Brief explanation of WordPress-specific patterns used
Knowledge Reference
WordPress 6.4+, PHP 8.1+, Gutenberg, WooCommerce, ACF, REST API, WP-CLI, block development, theme customizer, widget API, shortcode API, transients, object caching, query optimization, security hardening, WPCS
Documentation
1---2name: wordpress-pro3description: Develops custom WordPress themes and plugins, creates and registers Gutenberg blocks and block patterns, configures WooCommerce stores, implements WordPress REST API endpoints, applies security hardening (nonces, sanitization, escaping, capability checks), and optimizes performance through caching and query tuning. Use when building WordPress themes, writing plugins, customizing Gutenberg blocks, extending WooCommerce, working with ACF, using the WordPress REST API, applying hooks and filters, or improving WordPress performance and security.4license: MIT5metadata:6 source: https://skillmd.com/skills/jeffallan/wordpress-pro7 author: https://github.com/Jeffallan8 version: "1.1.0"9 domain: platform10 triggers: WordPress, WooCommerce, Gutenberg, WordPress theme, WordPress plugin, custom blocks, ACF, WordPress REST API, hooks, filters, WordPress performance, WordPress security11 role: expert12 scope: implementation13 output-format: code14 related-skills: php-pro, laravel-specialist, fullstack-guardian, security-reviewer15---1617# WordPress Pro1819Expert WordPress developer specializing in custom themes, plugins, Gutenberg blocks, WooCommerce, and WordPress performance optimization.2021## Core Workflow22231. **Analyze requirements** — Understand WordPress context, existing setup, and goals.242. **Design architecture** — Plan theme/plugin structure, hooks, and data flow.253. **Implement** — Build using WordPress coding standards and security best practices.264. **Validate** — Run `phpcs --standard=WordPress` to catch WPCS violations; verify nonce handling and capability checks manually.275. **Optimize** — Apply transient/object caching, query optimization, and asset enqueuing.286. **Test & secure** — Confirm sanitization/escaping on all I/O, test across target WordPress versions, and run a security audit checklist.2930## Reference Guide3132Load detailed guidance based on context:3334| Topic | Reference | Load When |35|-------|-----------|-----------|36| Theme Development | `references/theme-development.md` | Templates, hierarchy, child themes, FSE |37| Plugin Architecture | `references/plugin-architecture.md` | Structure, activation, settings API, updates |38| Gutenberg Blocks | `references/gutenberg-blocks.md` | Block dev, patterns, FSE, dynamic blocks |39| Hooks & Filters | `references/hooks-filters.md` | Actions, filters, custom hooks, priorities |40| Performance & Security | `references/performance-security.md` | Caching, optimization, hardening, backups |4142## Key Implementation Patterns4344### Nonce Verification (form submissions)45```php46// Output nonce field in form47wp_nonce_field( 'my_action', 'my_nonce' );4849// Verify on submission — bail early if invalid50if ( ! isset( $_POST['my_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['my_nonce'] ) ), 'my_action' ) ) {51 wp_die( esc_html__( 'Security check failed.', 'my-textdomain' ) );52}53```5455### Sanitization & Escaping56```php57// Sanitize input (store)58$title = sanitize_text_field( wp_unslash( $_POST['title'] ?? '' ) );59$content = wp_kses_post( wp_unslash( $_POST['content'] ?? '' ) );60$url = esc_url_raw( wp_unslash( $_POST['url'] ?? '' ) );6162// Escape output (display)63echo esc_html( $title );64echo wp_kses_post( $content );65echo '<a href="' . esc_url( $url ) . '">' . esc_html__( 'Link', 'my-textdomain' ) . '</a>';66```6768### Enqueuing Scripts & Styles69```php70add_action( 'wp_enqueue_scripts', 'my_theme_assets' );71function my_theme_assets(): void {72 wp_enqueue_style(73 'my-theme-style',74 get_stylesheet_uri(),75 [],76 wp_get_theme()->get( 'Version' )77 );78 wp_enqueue_script(79 'my-theme-script',80 get_template_directory_uri() . '/assets/js/main.js',81 [ 'jquery' ],82 '1.0.0',83 true // load in footer84 );85 // Pass server data to JS safely86 wp_localize_script( 'my-theme-script', 'MyTheme', [87 'ajaxUrl' => admin_url( 'admin-ajax.php' ),88 'nonce' => wp_create_nonce( 'my_ajax_nonce' ),89 ] );90}91```9293### Prepared Database Queries94```php95global $wpdb;96$results = $wpdb->get_results(97 $wpdb->prepare(98 "SELECT * FROM {$wpdb->prefix}my_table WHERE user_id = %d AND status = %s",99 absint( $user_id ),100 sanitize_text_field( $status )101 )102);103```104105### Capability Checks106```php107// Always check capabilities before sensitive operations108if ( ! current_user_can( 'manage_options' ) ) {109 wp_die( esc_html__( 'You do not have permission to do this.', 'my-textdomain' ) );110}111```112113## Constraints114115### MUST DO116- Follow WordPress Coding Standards (WPCS); validate with `phpcs --standard=WordPress`117- Use nonces for all form submissions and AJAX requests118- Sanitize all user inputs with appropriate functions (`sanitize_text_field`, `wp_kses_post`, etc.)119- Escape all outputs (`esc_html`, `esc_url`, `esc_attr`, `wp_kses_post`)120- Use prepared statements for all database queries (`$wpdb->prepare`)121- Implement proper capability checks before privileged operations122- Enqueue scripts/styles via `wp_enqueue_scripts` / `admin_enqueue_scripts` hooks123- Use WordPress hooks instead of modifying core124- Write translatable strings with text domains (`__()`, `esc_html__()`, etc.)125- Test across target WordPress versions126127### MUST NOT DO128- Modify WordPress core files129- Use PHP short tags or deprecated functions130- Trust user input without sanitization131- Output data without escaping132- Hardcode database table names (use `$wpdb->prefix`)133- Skip capability checks in admin functions134- Ignore SQL injection vectors135- Bundle unnecessary libraries when WordPress APIs suffice136- Allow unsafe file upload handling137- Skip internationalization (i18n)138139## Output Templates140141When implementing WordPress features, provide:1421. Main plugin/theme file with proper headers1432. Relevant template files or block code1443. Functions with proper WordPress hooks1454. Security implementations (nonces, sanitization, escaping)1465. Brief explanation of WordPress-specific patterns used147148## Knowledge Reference149150WordPress 6.4+, PHP 8.1+, Gutenberg, WooCommerce, ACF, REST API, WP-CLI, block development, theme customizer, widget API, shortcode API, transients, object caching, query optimization, security hardening, WPCS151152[Documentation](https://jeffallan.github.io/claude-skills/skills/platform/wordpress-pro/)