wordpress-pro by jeffallan/claude-skills
npx skills add https://github.com/jeffallan/claude-skills --skill wordpress-pro专业的 WordPress 开发专家,专注于自定义主题、插件、Gutenberg 区块、WooCommerce 以及 WordPress 性能优化。
phpcs --standard=WordPress 以捕获 WPCS 违规;手动验证 nonce 处理和权限检查。根据上下文加载详细指导:
| 主题 | 参考文件 | 加载时机 |
|---|---|---|
| 主题开发 | references/theme-development.md | 模板、层级、子主题、全站编辑 |
| 插件架构 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
references/plugin-architecture.md| 结构、激活、设置 API、更新 |
| Gutenberg 区块 | references/gutenberg-blocks.md | 区块开发、模式、全站编辑、动态区块 |
| 钩子与过滤器 | references/hooks-filters.md | 动作、过滤器、自定义钩子、优先级 |
| 性能与安全 | references/performance-security.md | 缓存、优化、加固、备份 |
// 在表单中输出 nonce 字段
wp_nonce_field( 'my_action', 'my_nonce' );
// 提交时验证 — 如果无效则提前退出
if ( ! isset( $_POST['my_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['my_nonce'] ) ), 'my_action' ) ) {
wp_die( esc_html__( '安全检查失败。', 'my-textdomain' ) );
}
// 净化输入(存储)
$title = sanitize_text_field( wp_unslash( $_POST['title'] ?? '' ) );
$content = wp_kses_post( wp_unslash( $_POST['content'] ?? '' ) );
$url = esc_url_raw( wp_unslash( $_POST['url'] ?? '' ) );
// 转义输出(显示)
echo esc_html( $title );
echo wp_kses_post( $content );
echo '<a href="' . esc_url( $url ) . '">' . esc_html__( '链接', 'my-textdomain' ) . '</a>';
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 // 在页脚加载
);
// 安全地将服务器数据传递给 JS
wp_localize_script( 'my-theme-script', 'MyTheme', [
'ajaxUrl' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( 'my_ajax_nonce' ),
] );
}
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 )
)
);
// 在执行敏感操作前始终检查权限
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( esc_html__( '您没有执行此操作的权限。', 'my-textdomain' ) );
}
phpcs --standard=WordPress 进行验证sanitize_text_field, wp_kses_post 等)esc_html, esc_url, esc_attr, wp_kses_post)$wpdb->prepare)wp_enqueue_scripts / admin_enqueue_scripts 钩子入队脚本/样式__(), esc_html__() 等)$wpdb->prefix)在实现 WordPress 功能时,请提供:
WordPress 6.4+, PHP 8.1+, Gutenberg, WooCommerce, ACF, REST API, WP-CLI, 区块开发, 主题定制器, 小工具 API, 短代码 API, 瞬态, 对象缓存, 查询优化, 安全加固, WPCS
每周安装量
2.4K
代码仓库
GitHub 星标
7.3K
首次出现
Jan 20, 2026
安全审计
安装于
opencode2.1K
gemini-cli2.1K
codex2.0K
github-copilot2.0K
amp1.8K
kimi-cli1.8K
Expert WordPress developer specializing in custom themes, plugins, Gutenberg blocks, WooCommerce, and WordPress performance optimization.
phpcs --standard=WordPress to catch WPCS violations; verify nonce handling and capability checks manually.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 |
// 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' ) );
}
// 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>';
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' ),
] );
}
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 )
)
);
// 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' ) );
}
phpcs --standard=WordPresssanitize_text_field, wp_kses_post, etc.)esc_html, esc_url, esc_attr, wp_kses_post)$wpdb->prepare)wp_enqueue_scripts / hooks$wpdb->prefix)When implementing WordPress features, provide:
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
Weekly Installs
2.4K
Repository
GitHub Stars
7.3K
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
opencode2.1K
gemini-cli2.1K
codex2.0K
github-copilot2.0K
amp1.8K
kimi-cli1.8K
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装
admin_enqueue_scripts__(), esc_html__(), etc.)