wp-interactivity-api

Develop and debug WordPress Interactivity API features with data-wp directives.

3|Updated Feb 21, 2026
One-click install
npx skills add https://github.com/ihatesea69/HieuNghi-AI-Skills --skill wp-interactivity-api-ihatesea69
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wp-interactivity-api
Source: https://github.com/ihatesea69/HieuNghi-AI-Skills/tree/main/wordpress_skills/wp-interactivity-api
Command: npx skills add https://github.com/ihatesea69/HieuNghi-AI-Skills --skill wp-interactivity-api-ihatesea69

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers build and debug interactive features in WordPress using the Interactivity API, ensuring smooth user experiences and efficient data handling.

Core Features & Use Cases

  • Directive Implementation: Guides on using data-wp-* directives for dynamic behavior.
  • State Management: Assists with @wordpress/interactivity store, state, and actions.
  • Server-Side Rendering: Provides best practices for pre-rendering HTML and hydrating client-side.
  • Debugging: Helps resolve issues with directives not firing or hydration mismatches.
  • Use Case: Implementing a dynamic product filter on a WordPress theme where selecting a category instantly updates the displayed products without a full page reload.

Quick Start

Use the wp-interactivity-api skill to debug why data-wp-on--click directives are not firing on a custom block.

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 that are not firing?

To debug WordPress Interactivity API directives not firing, verify your module-based viewScriptModule integration and ensure the @wordpress/interactivity store is correctly initialized. Check for hydration mismatches and confirm directive syntax matches WordPress 6.9+ standards.

How does state management work in the WordPress Interactivity API?

State management in the WordPress Interactivity API works via the @wordpress/interactivity store. You define state and actions in JavaScript, which are then accessed through data-wp-* directives in your HTML to trigger dynamic behavior without full page reloads.

What's the best way to handle server-side rendering and client-side hydration in WordPress interactive blocks?

The best way to handle hydration in WordPress interactive blocks is pre-rendering HTML on the server side and hydrating client-side. This ensures smooth user experiences and prevents hydration mismatches by aligning server output with client state expectations.

Does the WordPress Interactivity API require PHP and JavaScript knowledge?

Yes, the WordPress Interactivity API requires understanding of PHP, JavaScript, and WordPress block development. You need PHP for server-side rendering and module integration, and JavaScript for managing the interactivity store and client-side directive behavior.

Why are my data-wp-on--click directives failing to update the store in my custom block?

Your data-wp-on--click directives may fail due to incorrect store initialization or hydration mismatches. Validate that your @wordpress/interactivity store actions are properly bound and that your viewScriptModule integration is correctly enqueued in WordPress 6.9+.

Can I build dynamic product filters without a full page reload using the WordPress Interactivity API?

Yes, you can build dynamic product filters using the WordPress Interactivity API. By combining data-wp-* directives with state management, selecting a category instantly updates displayed products on the client side without requiring a full page reload.