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.
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.
Real-Time Collaboration (RTC) Compatibility
sync.providers filtershow_in_rest => trueAI Connector Integration
wp_ai_client_prompt()Abilities API
/wp-json/abilities/v1/manifestDataViews & DataForm
PHP-Only Blocks
Use this workflow when:
app-builder - Project scaffoldingbackend-dev-guidelines - Backend patterns/*
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+
*/
Use @app-builder to scaffold a new WordPress plugin
backend-dev-guidelines - Architecture patternsUse @backend-dev-guidelines to design plugin architecture
wordpress-penetration-testing - WordPress patternsUse @wordpress-penetration-testing to understand WordPress hooks
frontend-developer - Admin UIimport { 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}
/>
);
};
Use @frontend-developer to create WordPress admin interface
database-design - Database designpostgresql - Database patterns// 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,
]);
Use @database-design to design plugin database schema
api-design-principles - API designapi-patterns - API patternsUse @api-design-principles to create WordPress REST API endpoints
wordpress-penetration-testing - WordPress securitysecurity-scanning-security-sast - Security scanningUse @wordpress-penetration-testing to audit plugin security
api-design-principles - AI integrationbackend-dev-guidelines - Block development// 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));
}
}
// 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)];
}
// 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 RTC for specific post types
import { addFilter } from '@wordpress/hooks';
addFilter(
'sync.providers',
'my-plugin/disable-collab',
() => []
);
test-automator - Test automationphp-pro - PHP testingUse @test-automator to set up plugin testing
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/
show_in_rest => true for RTCwatch() not effectwordpress - WordPress developmentwordpress-theme-development - Theme developmentwordpress-woocommerce - WooCommerce