wp-interactivity-api

Diagnose and implement WordPress Interactivity API directives and store integration.

Updated Jan 29, 2026
One-click install
npx skills add https://github.com/HungNth/wordpress-notify-nth --skill wp-interactivity-api-hungnth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wp-interactivity-api
Source: https://github.com/HungNth/wordpress-notify-nth/tree/main/.opencode/skills/wp-interactivity-api
Command: npx skills add https://github.com/HungNth/wordpress-notify-nth --skill wp-interactivity-api-hungnth

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides structured guidance to diagnose, implement, and maintain WordPress Interactivity API features, including data-wp-* directives, block viewScriptModule integration, hydration, and server-side rendering, enabling robust interactive experiences in WordPress blocks, themes, and plugins.

Core Features & Use Cases

  • Understand when and how to apply the Interactivity API to a WordPress project, including front-end interactions and editor integrations.
  • Identify stores, contexts, and directives used by interactive blocks and themes, and outline best practices for server-side rendering and hydration.
  • Use concrete scenarios to troubleshoot issues such as directive processing, view script loading, and state-driven rendering across WordPress 6.9+ environments.

Quick Start

Open a WP project with Interactivity API usage, locate the relevant block/theme/plugin code, and follow the step-by-step guidance to enable server-side rendering, initialize global state, and implement directives.

Frequently Asked Questions about wp-interactivity-api

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug WordPress Interactivity API directives not working in my block?

To debug WordPress Interactivity API directives, inspect the data-wp-* attributes in your block markup and verify the viewScriptModule integration. Ensure the @wordpress/interactivity store, state, and actions are correctly initialized and that server-side rendering matches the client-side hydration.

Why does my WordPress interactive block fail hydration on the front-end?

WordPress interactive block hydration fails when server-side rendered HTML does not match the client-side state initialization. Validate that your @wordpress/interactivity store context and data-wp-* directives align perfectly between PHP render callbacks and JavaScript viewScriptModule outputs.

How do I initialize global state and context for a WordPress interactive block?

Initialize global state and context for a WordPress interactive block by defining the store, actions, and state within your viewScriptModule. Use block.json to enqueue the module and ensure data-wp-* directives correctly reference the initialized properties for proper server-side rendering.

Does the WordPress Interactivity API support server-side rendering in WordPress 6.9?

Yes, the WordPress Interactivity API supports server-side rendering in WordPress 6.9 and above. It processes data-wp-* directives during rendering, requiring proper PHP and JS tooling configuration to synchronize block viewScriptModule hydration and state initialization across themes and plugins.

What is the best way to troubleshoot view script loading in WordPress interactive themes?

The best way to troubleshoot view script loading in WordPress interactive themes is to verify block.json viewScriptModule paths and dependencies. Confirm the script correctly registers the @wordpress/interactivity store and that data-wp-* directives process the expected state and actions without blocking hydration.

When should I not use the WordPress Interactivity API for front-end interactions?

You should not use the WordPress Interactivity API for front-end interactions when your block requires complex state management beyond directive processing or relies on incompatible PHP/JS tooling. It is specifically designed for server-side rendered blocks needing hydration, state, and context synchronization.