科研技能库/WordPress 插件开发工作流
code_research
低风险

WordPress 插件开发工作流

WordPress 插件开发工作流,涵盖插件架构、钩子系统、管理界面、REST API、安全最佳实践,以及 WordPress 7.0 新增功能:实时协作、AI 连接器、Abilities API、DataViews 和纯 PHP 区块。

文件预览

1 个文件
SKILL.md
13.6 KB · 可预览
---
name: wordpress-plugin-development
description: "WordPress plugin development workflow covering plugin architecture, hooks, admin interfaces, REST API, security best practices, and WordPress 7.0 features: Real-Time Collaboration, AI Connectors, Abilities API, DataViews, and PHP-only blocks."
category: granular-workflow-bundle
risk: safe
source: personal
date_added: "2026-02-27"
---

# WordPress Plugin Development Workflow

## Overview

Specialized workflow for creating WordPress plugins with proper architecture, hooks system, admin interfaces, REST API endpoints, and security practices. Now includes WordPress 7.0 features for modern plugin development.

## WordPress 7.0 Plugin Development

### Key Features for Plugin Developers

1. **Real-Time Collaboration (RTC) Compatibility**
   - Yjs-based CRDT for simultaneous editing
   - Custom transport via `sync.providers` filter
   - **Requirement**: Register post meta with `show_in_rest => true`

2. **AI Connector Integration**
   - Provider-agnostic AI via `wp_ai_client_prompt()`
   - Settings > Connectors admin screen
   - Works with OpenAI, Claude, Gemini, Ollama

3. **Abilities API**
   - Declare plugin capabilities for AI agents
   - REST API: `/wp-json/abilities/v1/manifest`
   - MCP adapter support

4. **DataViews & DataForm**
   - Modern admin interfaces
   - Replaces WP_List_Table patterns
   - Built-in validation

5. **PHP-Only Blocks**
   - Register blocks without JavaScript
   - Auto-generated Inspector controls

## When to Use This Workflow

Use this workflow when:
- Creating custom WordPress plugins
- Extending WordPress functionality
- Building admin interfaces
- Adding REST API endpoints
- Integrating third-party services
- Implementing WordPress 7.0 AI/Collaboration features

## Workflow Phases

### Phase 1: Plugin Setup

#### Skills to Invoke
- `app-builder` - Project scaffolding
- `backend-dev-guidelines` - Backend patterns

#### Actions
1. Create plugin directory structure
2. Set up main plugin file with header
3. Implement activation/deactivation hooks
4. Set up autoloading
5. Configure text domain

#### WordPress 7.0 Plugin Header
```php
/*
Plugin Name: My Plugin
Plugin URI: https://example.com/my-plugin
Description: A WordPress 7.0 compatible plugin with AI and RTC support
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Author: Developer Name
License: GPL2+
*/
```

#### Copy-Paste Prompts
```
Use @app-builder to scaffold a new WordPress plugin
```

### Phase 2: Plugin Architecture

#### Skills to Invoke
- `backend-dev-guidelines` - Architecture patterns

#### Actions
1. Design plugin class structure
2. Implement singleton pattern
3. Create loader class
4. Set up dependency injection
5. Configure plugin lifecycle

#### WordPress 7.0 Architecture Considerations
- Prepare for iframed editor compatibility
- Design for collaboration-aware data flows
- Consider Abilities API for AI integration

#### Copy-Paste Prompts
```
Use @backend-dev-guidelines to design plugin architecture
```

### Phase 3: Hooks Implementation

#### Skills to Invoke
- `wordpress-penetration-testing` - WordPress patterns

#### Actions
1. Register action hooks
2. Create filter hooks
3. Implement callback functions
4. Set up hook priorities
5. Add conditional hooks

#### Copy-Paste Prompts
```
Use @wordpress-penetration-testing to understand WordPress hooks
```

### Phase 4: Admin Interface

#### Skills to Invoke
- `frontend-developer` - Admin UI

#### Actions
1. Create admin menu
2. Build settings pages
3. Implement options registration
4. Add settings sections/fields
5. Create admin notices

#### WordPress 7.0 Admin Considerations
- Test with new admin color scheme
- Consider DataViews for data displays
- Implement view transitions
- Use new validation patterns

#### DataViews Example
```javascript
import { DataViews } from '@wordpress/dataviews';

const MyPluginDataView = () => {
    const data = [/* records */];
    const fields = [
        { id: 'title', label: 'Title', sortable: true },
        { id: 'status', label: 'Status', filterBy: true }
    ];
    const view = {
        type: 'table',
        perPage: 10,
        sort: { field: 'title', direction: 'asc' }
    };

    return (
        <DataViews
            data={data}
            fields={fields}
            view={view}
            onChangeView={handleViewChange}
        />
    );
};
```

#### Copy-Paste Prompts
```
Use @frontend-developer to create WordPress admin interface
```

### Phase 5: Database Operations

#### Skills to Invoke
- `database-design` - Database design
- `postgresql` - Database patterns

#### Actions
1. Create custom tables
2. Implement CRUD operations
3. Add data validation
4. Set up data sanitization
5. Create data upgrade routines

#### RTC-Compatible Post Meta
```php
// Register meta for Real-Time Collaboration
register_post_meta('post', 'my_custom_field', [
    'type' => 'string',
    'single' => true,
    'show_in_rest' => true,  // Required for RTC
    'sanitize_callback' => 'sanitize_text_field',
]);

// For WP 7.0, also consider:
register_term_meta('category', 'my_term_field', [
    'type' => 'string',
    'show_in_rest' => true,
]);
```

#### Copy-Paste Prompts
```
Use @database-design to design plugin database schema
```

### Phase 6: REST API

#### Skills to Invoke
- `api-design-principles` - API design
- `api-patterns` - API patterns

#### Actions
1. Register REST routes
2. Create endpoint callbacks
3. Implement permission callbacks
4. Add request validation
5. Document API endpoints

#### WordPress 7.0 REST API Enhancements
- Abilities API integration
- AI Connector endpoints
- Enhanced validation

#### Copy-Paste Prompts
```
Use @api-design-principles to create WordPress REST API endpoints
```

### Phase 7: Security

#### Skills to Invoke
- `wordpress-penetration-testing` - WordPress security
- `security-scanning-security-sast` - Security scanning

#### Actions
1. Implement nonce verification
2. Add capability checks
3. Sanitize all inputs
4. Escape all outputs
5. Secure database queries

#### WordPress 7.0 Security Considerations
- Test Abilities API permission boundaries
- Validate AI connector credential handling
- Review collaboration data isolation
- PHP 7.4+ requirement compliance

#### Copy-Paste Prompts
```
Use @wordpress-penetration-testing to audit plugin security
```

### Phase 8: WordPress 7.0 Features

#### Skills to Invoke
- `api-design-principles` - AI integration
- `backend-dev-guidelines` - Block development

#### AI Connector Implementation
```php
// Using WordPress 7.0 AI Connector
add_action('save_post', 'my_plugin_generate_ai_summary', 10, 2);

function my_plugin_generate_ai_summary($post_id, $post) {
    if (wp_is_post_autosave($post_id) || wp_is_post_revision($post_id)) {
        return;
    }
    
    // Check if AI client is available
    if (!function_exists('wp_ai_client_prompt')) {
        return;
    }
    
    $content = strip_tags($post->post_content);
    if (empty($content)) {
        return;
    }
    
    // Build prompt - direct string concatenation for input
    $result = wp_ai_client_prompt(
        'Create a compelling 2-sentence summary for social media: ' . substr($content, 0, 1000)
    );
    
    if (is_wp_error($result)) {
        return;
    }
    
    // Set temperature for consistent output
    $result->using_temperature(0.3);
    $summary = $result->generate_text();
    
    if ($summary && !is_wp_error($summary)) {
        update_post_meta($post_id, '_ai_summary', sanitize_textarea_field($summary));
    }
}
```

#### Abilities API Registration
```php
// Register ability categories on their own hook
add_action('wp_abilities_api_categories_init', function() {
    wp_register_ability_category('content-creation', [
        'label' => __('Content Creation', 'my-plugin'),
        'description' => __('Abilities for generating and managing content', 'my-plugin'),
    ]);
});

// Register abilities on their own hook
add_action('wp_abilities_api_init', function() {
    wp_register_ability('my-plugin/generate-summary', [
        'label' => __('Generate Summary', 'my-plugin'),
        'description' => __('Creates an AI-powered summary of content', 'my-plugin'),
        'category' => 'content-creation',
        'input_schema' => [
            'type' => 'object',
            'properties' => [
                'content' => ['type' => 'string'],
                'length' => ['type' => 'integer', 'default' => 2]
            ],
            'required' => ['content']
        ],
        'output_schema' => [
            'type' => 'object',
            'properties' => [
                'summary' => ['type' => 'string']
            ]
        ],
        'execute_callback' => 'my_plugin_generate_summary_cb',
        'permission_callback' => function() {
            return current_user_can('edit_posts');
        }
    ]);
});

// Handler callback
function my_plugin_generate_summary_cb($input) {
    $content = isset($input['content']) ? $input['content'] : '';
    $length = isset($input['length']) ? absint($input['length']) : 2;
    
    if (empty($content)) {
        return new WP_Error('empty_content', 'No content provided');
    }
    
    if (!function_exists('wp_ai_client_prompt')) {
        return new WP_Error('ai_unavailable', 'AI not available');
    }
    
    $prompt = sprintf('Create a %d-sentence summary of: %s', $length, substr($content, 0, 2000));
    
    $result = wp_ai_client_prompt($prompt)
        ->using_temperature(0.3)
        ->generate_text();
    
    if (is_wp_error($result)) {
        return $result;
    }
    
    return ['summary' => sanitize_textarea_field($result)];
}
```

#### PHP-Only Block Registration
```php
// Register block entirely in PHP (WordPress 7.0)
// Note: For full PHP-only blocks, use block.json with PHP render_callback

// First, create a block.json file in build/ or includes/blocks/
// Then register in PHP:

// Simple PHP-only block registration (WordPress 7.0+)
if (function_exists('register_block_type')) {
    register_block_type('my-plugin/featured-post', [
        'render_callback' => function($attributes, $content, $block) {
            $post_id = isset($attributes['postId']) ? absint($attributes['postId']) : 0;
            
            if (!$post_id) {
                $post_id = get_the_ID();
            }
            
            $post = get_post($post_id);
            
            if (!$post) {
                return '';
            }
            
            $title = esc_html($post->post_title);
            $excerpt = esc_html(get_the_excerpt($post));
            
            return sprintf(
                '<div class="featured-post"><h2>%s</h2><p>%s</p></div>',
                $title,
                $excerpt
            );
        },
        'attributes' => [
            'postId' => ['type' => 'integer', 'default' => 0],
            'showExcerpt' => ['type' => 'boolean', 'default' => true]
        ],
    ]);
}
```

#### Disable Collaboration (if needed)
```javascript
// Disable RTC for specific post types
import { addFilter } from '@wordpress/hooks';

addFilter(
    'sync.providers',
    'my-plugin/disable-collab',
    () => []
);
```

### Phase 9: Testing

#### Skills to Invoke
- `test-automator` - Test automation
- `php-pro` - PHP testing

#### Actions
1. Set up PHPUnit
2. Create unit tests
3. Write integration tests
4. Test with WordPress test suite
5. Configure CI

#### WordPress 7.0 Testing Priorities
- Test RTC compatibility
- Verify AI connector functionality
- Validate DataViews integration
- Test Interactivity API with watch()

#### Copy-Paste Prompts
```
Use @test-automator to set up plugin testing
```

## Plugin Structure

```
plugin-name/
├── plugin-name.php
├── includes/
│   ├── class-plugin.php
│   ├── class-loader.php
│   ├── class-activator.php
│   └── class-deactivator.php
├── admin/
│   ├── class-plugin-admin.php
│   ├── css/
│   └── js/
├── public/
│   ├── class-plugin-public.php
│   ├── css/
│   └── js/
├── blocks/           # PHP-only blocks (WP 7.0)
├── abilities/        # Abilities API
├── ai/               # AI Connector integration
├── languages/
└── vendor/
```

## WordPress 7.0 Compatibility Checklist

- [ ] PHP 7.4+ requirement documented
- [ ] Post meta registered with `show_in_rest => true` for RTC
- [ ] Meta boxes migrated to block-based UIs
- [ ] AI Connector integration tested
- [ ] Abilities API registered (if applicable)
- [ ] DataViews integration tested (if applicable)
- [ ] Interactivity API uses `watch()` not `effect`
- [ ] Tested with iframed editor
- [ ] Collaboration fallback works (post locking)

## Quality Gates

- [ ] Plugin activates without errors
- [ ] All hooks working
- [ ] Admin interface functional
- [ ] Security measures implemented
- [ ] Tests passing
- [ ] Documentation complete
- [ ] WordPress 7.0 compatibility verified

## Related Workflow Bundles

- `wordpress` - WordPress development
- `wordpress-theme-development` - Theme development
- `wordpress-woocommerce` - WooCommerce

## Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

SKILL.md

元数据
namewordpress-plugin-development
descriptionWordPress 插件开发工作流,涵盖插件架构、钩子系统、管理界面、REST API、安全最佳实践,以及 WordPress 7.0 新增功能:实时协作、AI 连接器、Abilities API、DataViews 和纯 PHP 区块。
categorygranular-workflow-bundle
risksafe
sourcepersonal
date_added2026-02-27

WordPress 插件开发工作流

概述

专业的 WordPress 插件创建工作流,包含正确的架构、钩子系统、管理界面、REST API 端点及安全实践。现已包含面向现代插件开发的 WordPress 7.0 功能。

WordPress 7.0 插件开发

对插件开发者重要的功能

  1. 实时协作 (RTC) 兼容性

    • 基于 Yjs 的 CRDT 实现同时编辑
    • 通过 sync.providers 过滤器自定义传输
    • 要求:注册文章元数据时设置 show_in_rest => true
  2. AI 连接器集成

    • 通过 wp_ai_client_prompt() 实现提供商无关的 AI
    • 设置 > 连接器管理界面
    • 支持 OpenAI、Claude、Gemini、Ollama
  3. Abilities API

    • 为 AI 代理声明插件能力
    • REST API 端点:/wp-json/abilities/v1/manifest
    • MCP 适配器支持
  4. DataViews 与 DataForm

    • 现代化的管理界面
    • 取代 WP_List_Table 模式
    • 内置验证
  5. 纯 PHP 区块

    • 无需 JavaScript 即可注册区块
    • 自动生成 Inspector 控件

何时使用此工作流

当出现以下需求时使用:

  • 创建自定义 WordPress 插件
  • 扩展 WordPress 功能
  • 构建管理界面
  • 增加 REST API 端点
  • 集成第三方服务
  • 实现 WordPress 7.0 AI/协作功能

工作流阶段

阶段 1:插件准备

需调用的技能

  • app-builder - 项目脚手架
  • backend-dev-guidelines - 后端模式

操作步骤

  1. 创建插件目录结构
  2. 编写主插件文件及头部信息
  3. 实现激活/停用钩子
  4. 配置自动加载
  5. 设置文本域

WordPress 7.0 插件头

php
/*
Plugin Name: My Plugin
Plugin URI: https://example.com/my-plugin
Description: A WordPress 7.0 compatible plugin with AI and RTC support
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Author: Developer Name
License: GPL2+
*/

复制粘贴提示

text
请使用 @app-builder 脚手架创建一个新的 WordPress 插件

阶段 2:插件架构

需调用的技能

  • backend-dev-guidelines - 架构模式

操作步骤

  1. 设计插件类结构
  2. 实现单例模式
  3. 创建加载器类
  4. 配置依赖注入
  5. 设置插件生命周期

WordPress 7.0 架构注意事项

  • 为 iframe 编辑器的兼容性做好准备
  • 设计面向协作的数据流
  • 考虑使用 Abilities API 进行 AI 集成

复制粘贴提示

text
请使用 @backend-dev-guidelines 设计插件架构

阶段 3:钩子实现

需调用的技能

  • wordpress-penetration-testing - WordPress 模式

操作步骤

  1. 注册动作钩子
  2. 创建过滤器钩子
  3. 实现回调函数
  4. 设置钩子优先级
  5. 添加条件钩子

复制粘贴提示

text
请使用 @wordpress-penetration-testing 了解 WordPress 钩子

阶段 4:管理界面

需调用的技能

  • frontend-developer - 管理界面 UI

操作步骤

  1. 创建管理菜单
  2. 构建设置页面
  3. 实现选项注册
  4. 添加设置分区/字段
  5. 创建管理通知

WordPress 7.0 管理界面注意事项

  • 使用新的管理配色方案进行测试
  • 考虑使用 DataViews 展示数据
  • 实现视图过渡动画
  • 使用新的验证模式

DataViews 示例

javascript
import { DataViews } from '@wordpress/dataviews';

const MyPluginDataView = () => {
    const data = [/* records */];
    const fields = [
        { id: 'title', label: 'Title', sortable: true },
        { id: 'status', label: 'Status', filterBy: true }
    ];
    const view = {
        type: 'table',
        perPage: 10,
        sort: { field: 'title', direction: 'asc' }
    };

    return (
        <DataViews
            data={data}
            fields={fields}
            view={view}
            onChangeView={handleViewChange}
        />
    );
};

复制粘贴提示

text
请使用 @frontend-developer 创建 WordPress 管理界面

阶段 5:数据库操作

需调用的技能

  • database-design - 数据库设计
  • postgresql - 数据库模式

操作步骤

  1. 创建自定义数据表
  2. 实现 CRUD 操作
  3. 添加数据验证
  4. 设置数据净化
  5. 编写数据升级例程

支持 RTC 的文章元数据

php
// 为实时协作注册元数据
register_post_meta('post', 'my_custom_field', [
    'type' => 'string',
    'single' => true,
    'show_in_rest' => true,  // RTC 必须
    'sanitize_callback' => 'sanitize_text_field',
]);

// 对于 WP 7.0,还可考虑:
register_term_meta('category', 'my_term_field', [
    'type' => 'string',
    'show_in_rest' => true,
]);

复制粘贴提示

text
请使用 @database-design 设计插件数据库架构

阶段 6:REST API

需调用的技能

  • api-design-principles - API 设计
  • api-patterns - API 模式

操作步骤

  1. 注册 REST 路由
  2. 创建端点回调
  3. 实现权限回调
  4. 添加请求验证
  5. 记录 API 端点文档

WordPress 7.0 REST API 增强

  • Abilities API 集成
  • AI 连接器端点
  • 增强的验证

复制粘贴提示

text
请使用 @api-design-principles 创建 WordPress REST API 端点

阶段 7:安全

需调用的技能

  • wordpress-penetration-testing - WordPress 安全
  • security-scanning-security-sast - 安全扫描

操作步骤

  1. 实现 nonce 验证
  2. 添加权限检查
  3. 对所有输入进行净化
  4. 对所有输出进行转义
  5. 保护数据库查询

WordPress 7.0 安全注意事项

  • 测试 Abilities API 的权限边界
  • 验证 AI 连接器凭证处理
  • 审查协作数据隔离
  • 确保 PHP 7.4+ 要求合规

复制粘贴提示

text
请使用 @wordpress-penetration-testing 审计插件安全性

阶段 8:WordPress 7.0 功能

需调用的技能

  • api-design-principles - AI 集成
  • backend-dev-guidelines - 区块开发

AI 连接器实现

php
// 使用 WordPress 7.0 AI 连接器
add_action('save_post', 'my_plugin_generate_ai_summary', 10, 2);

function my_plugin_generate_ai_summary($post_id, $post) {
    if (wp_is_post_autosave($post_id) || wp_is_post_revision($post_id)) {
        return;
    }
    
    // 检查 AI 客户端是否可用
    if (!function_exists('wp_ai_client_prompt')) {
        return;
    }
    
    $content = strip_tags($post->post_content);
    if (empty($content)) {
        return;
    }
    
    // 构建提示词 - 直接使用字符串拼接输入
    $result = wp_ai_client_prompt(
        'Create a compelling 2-sentence summary for social media: ' . substr($content, 0, 1000)
    );
    
    if (is_wp_error($result)) {
        return;
    }
    
    // 设置 temperature 以输出一致结果
    $result->using_temperature(0.3);
    $summary = $result->generate_text();
    
    if ($summary && !is_wp_error($summary)) {
        update_post_meta($post_id, '_ai_summary', sanitize_textarea_field($summary));
    }
}

Abilities API 注册

php
// 在专用钩子上注册能力类别
add_action('wp_abilities_api_categories_init', function() {
    wp_register_ability_category('content-creation', [
        'label' => __('Content Creation', 'my-plugin'),
        'description' => __('Abilities for generating and managing content', 'my-plugin'),
    ]);
});

// 在专用钩子上注册能力
add_action('wp_abilities_api_init', function() {
    wp_register_ability('my-plugin/generate-summary', [
        'label' => __('Generate Summary', 'my-plugin'),
        'description' => __('Creates an AI-powered summary of content', 'my-plugin'),
        'category' => 'content-creation',
        'input_schema' => [
            'type' => 'object',
            'properties' => [
                'content' => ['type' => 'string'],
                'length' => ['type' => 'integer', 'default' => 2]
            ],
            'required' => ['content']
        ],
        'output_schema' => [
            'type' => 'object',
            'properties' => [
                'summary' => ['type' => 'string']
            ]
        ],
        'execute_callback' => 'my_plugin_generate_summary_cb',
        'permission_callback' => function() {
            return current_user_can('edit_posts');
        }
    ]);
});

// 处理回调函数
function my_plugin_generate_summary_cb($input) {
    $content = isset($input['content']) ? $input['content'] : '';
    $length = isset($input['length']) ? absint($input['length']) : 2;
    
    if (empty($content)) {
        return new WP_Error('empty_content', 'No content provided');
    }
    
    if (!function_exists('wp_ai_client_prompt')) {
        return new WP_Error('ai_unavailable', 'AI not available');
    }
    
    $prompt = sprintf('Create a %d-sentence summary of: %s', $length, substr($content, 0, 2000));
    
    $result = wp_ai_client_prompt($prompt)
        ->using_temperature(0.3)
        ->generate_text();
    
    if (is_wp_error($result)) {
        return $result;
    }
    
    return ['summary' => sanitize_textarea_field($result)];
}

纯 PHP 区块注册

php
// 完全使用 PHP 注册区块(WordPress 7.0)
// 注意:要实现完整的纯 PHP 区块,建议使用 block.json 配合 PHP render_callback

// 首先,在 build/ 或 includes/blocks/ 中创建 block.json 文件
// 然后在 PHP 中注册:

// 简单的纯 PHP 区块注册(WordPress 7.0+)
if (function_exists('register_block_type')) {
    register_block_type('my-plugin/featured-post', [
        'render_callback' => function($attributes, $content, $block) {
            $post_id = isset($attributes['postId']) ? absint($attributes['postId']) : 0;
            
            if (!$post_id) {
                $post_id = get_the_ID();
            }
            
            $post = get_post($post_id);
            
            if (!$post) {
                return '';
            }
            
            $title = esc_html($post->post_title);
            $excerpt = esc_html(get_the_excerpt($post));
            
            return sprintf(
                '<div class="featured-post"><h2>%s</h2><p>%s</p></div>',
                $title,
                $excerpt
            );
        },
        'attributes' => [
            'postId' => ['type' => 'integer', 'default' => 0],
            'showExcerpt' => ['type' => 'boolean', 'default' => true]
        ],
    ]);
}

禁用协作(如需)

javascript
// 为指定文章类型禁用 RTC
import { addFilter } from '@wordpress/hooks';

addFilter(
    'sync.providers',
    'my-plugin/disable-collab',
    () => []
);

阶段 9:测试

需调用的技能

  • test-automator - 测试自动化
  • php-pro - PHP 测试

操作步骤

  1. 配置 PHPUnit
  2. 编写单元测试
  3. 编写集成测试
  4. 使用 WordPress 测试套件进行测试
  5. 配置持续集成

WordPress 7.0 测试优先级

  • 测试 RTC 兼容性
  • 验证 AI 连接器功能
  • 验证 DataViews 集成
  • 测试 Interactivity API 的 watch()

复制粘贴提示

text
请使用 @test-automator 建立插件测试

插件结构

text
plugin-name/
├── plugin-name.php
├── includes/
│   ├── class-plugin.php
│   ├── class-loader.php
│   ├── class-activator.php
│   └── class-deactivator.php
├── admin/
│   ├── class-plugin-admin.php
│   ├── css/
│   └── js/
├── public/
│   ├── class-plugin-public.php
│   ├── css/
│   └── js/
├── blocks/           # 纯 PHP 区块(WP 7.0)
├── abilities/        # Abilities API
├── ai/               # AI 连接器集成
├── languages/
└── vendor/

WordPress 7.0 兼容性检查清单

  • 已注明 PHP 7.4+ 要求
  • 文章元数据已注册 show_in_rest => true 以支持协作
  • 元框已迁移到基于区块的 UI
  • AI 连接器集成已测试
  • Abilities API 已注册(如适用)
  • DataViews 集成已测试(如适用)
  • Interactivity API 使用 watch() 而非 effect
  • 已在 iframe 编辑器中测试
  • 协作回退方案有效(文章锁定)

质量闸门

  • 插件激活无错误
  • 所有钩子正常工作
  • 管理界面功能正常
  • 安全措施已实施
  • 测试全部通过
  • 文档齐全
  • WordPress 7.0 兼容性已验证

相关工作流套件

  • wordpress - WordPress 开发
  • wordpress-theme-development - 主题开发
  • wordpress-woocommerce - WooCommerce

限制

  • 仅当任务明确符合上述范围时才使用此技能。
  • 不要将输出视为环境特定验证、测试或专家评审的替代品。
  • 若缺少所需输入、权限、安全边界或成功标准,请停止并请求澄清。