wordpress-plugin-development

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

WordPress Plugin Development Workflow

WordPress插件开发工作流

Overview

概述

Specialized workflow for creating WordPress plugins with proper architecture, hooks system, admin interfaces, REST API endpoints, and security practices.
专为创建具备合理架构、钩子系统、管理界面、REST API端点及安全实践的WordPress插件设计的专属工作流。

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
在以下场景中使用此工作流:
  • 创建自定义WordPress插件
  • 扩展WordPress功能
  • 构建管理界面
  • 添加REST API端点
  • 集成第三方服务

Workflow Phases

工作流阶段

Phase 1: Plugin Setup

第一阶段:插件搭建

Skills to Invoke

需调用的技能

  • app-builder
    - Project scaffolding
  • backend-dev-guidelines
    - Backend patterns
  • app-builder
    - 项目脚手架搭建
  • backend-dev-guidelines
    - 后端开发模式

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
  1. 创建插件目录结构
  2. 搭建带有头部信息的主插件文件
  3. 实现激活/停用钩子
  4. 设置自动加载机制
  5. 配置文本域

Copy-Paste Prompts

可复制粘贴的提示词

Use @app-builder to scaffold a new WordPress plugin
Use @app-builder to scaffold a new WordPress plugin

Phase 2: Plugin Architecture

第二阶段:插件架构

Skills to Invoke

需调用的技能

  • backend-dev-guidelines
    - Architecture patterns
  • backend-dev-guidelines
    - 架构设计模式

Actions

操作步骤

  1. Design plugin class structure
  2. Implement singleton pattern
  3. Create loader class
  4. Set up dependency injection
  5. Configure plugin lifecycle
  1. 设计插件类结构
  2. 实现单例模式
  3. 创建加载器类
  4. 设置依赖注入
  5. 配置插件生命周期

Copy-Paste Prompts

可复制粘贴的提示词

Use @backend-dev-guidelines to design plugin architecture
Use @backend-dev-guidelines to design plugin architecture

Phase 3: Hooks Implementation

第三阶段:钩子实现

Skills to Invoke

需调用的技能

  • wordpress-penetration-testing
    - WordPress patterns
  • wordpress-penetration-testing
    - WordPress开发模式

Actions

操作步骤

  1. Register action hooks
  2. Create filter hooks
  3. Implement callback functions
  4. Set up hook priorities
  5. Add conditional hooks
  1. 注册动作钩子
  2. 创建过滤器钩子
  3. 实现回调函数
  4. 设置钩子优先级
  5. 添加条件钩子

Copy-Paste Prompts

可复制粘贴的提示词

Use @wordpress-penetration-testing to understand WordPress hooks
Use @wordpress-penetration-testing to understand WordPress hooks

Phase 4: Admin Interface

第四阶段:管理界面

Skills to Invoke

需调用的技能

  • frontend-developer
    - Admin UI
  • frontend-developer
    - 管理端UI开发

Actions

操作步骤

  1. Create admin menu
  2. Build settings pages
  3. Implement options registration
  4. Add settings sections/fields
  5. Create admin notices
  1. 创建管理菜单
  2. 构建设置页面
  3. 实现选项注册
  4. 添加设置板块/字段
  5. 创建管理通知

Copy-Paste Prompts

可复制粘贴的提示词

Use @frontend-developer to create WordPress admin interface
Use @frontend-developer to create WordPress admin interface

Phase 5: Database Operations

第五阶段:数据库操作

Skills to Invoke

需调用的技能

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

Actions

操作步骤

  1. Create custom tables
  2. Implement CRUD operations
  3. Add data validation
  4. Set up data sanitization
  5. Create data upgrade routines
  1. 创建自定义数据表
  2. 实现CRUD操作
  3. 添加数据验证
  4. 设置数据清理
  5. 创建数据升级程序

Copy-Paste Prompts

可复制粘贴的提示词

Use @database-design to design plugin database schema
Use @database-design to design plugin database schema

Phase 6: REST API

第六阶段:REST API

Skills to Invoke

需调用的技能

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

Actions

操作步骤

  1. Register REST routes
  2. Create endpoint callbacks
  3. Implement permission callbacks
  4. Add request validation
  5. Document API endpoints
  1. 注册REST路由
  2. 创建端点回调函数
  3. 实现权限回调
  4. 添加请求验证
  5. 编写API端点文档

Copy-Paste Prompts

可复制粘贴的提示词

Use @api-design-principles to create WordPress REST API endpoints
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
  • wordpress-penetration-testing
    - WordPress安全
  • security-scanning-security-sast
    - 安全扫描

Actions

操作步骤

  1. Implement nonce verification
  2. Add capability checks
  3. Sanitize all inputs
  4. Escape all outputs
  5. Secure database queries
  1. 实现随机数验证
  2. 添加权限检查
  3. 清理所有输入数据
  4. 转义所有输出内容
  5. 确保数据库查询安全

Copy-Paste Prompts

可复制粘贴的提示词

Use @wordpress-penetration-testing to audit plugin security
Use @wordpress-penetration-testing to audit plugin security

Phase 8: Testing

第八阶段:测试

Skills to Invoke

需调用的技能

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

Actions

操作步骤

  1. Set up PHPUnit
  2. Create unit tests
  3. Write integration tests
  4. Test with WordPress test suite
  5. Configure CI
  1. 搭建PHPUnit环境
  2. 创建单元测试
  3. 编写集成测试
  4. 使用WordPress测试套件测试
  5. 配置持续集成(CI)

Copy-Paste Prompts

可复制粘贴的提示词

Use @test-automator to set up plugin testing
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/
├── languages/
└── vendor/
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/
├── languages/
└── vendor/

Quality Gates

质量检查项

  • Plugin activates without errors
  • All hooks working
  • Admin interface functional
  • Security measures implemented
  • Tests passing
  • Documentation complete
  • 插件可正常激活无报错
  • 所有钩子功能正常
  • 管理界面可正常使用
  • 已落实安全防护措施
  • 所有测试通过
  • 文档完整

Related Workflow Bundles

相关工作流包

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