The WordPress Interactivity API is a server-side PHP and client-side JavaScript framework introduced in WordPress 6.5 (March 2024) that standardizes how developers build reactive, interactive elements inside block-based themes and plugins — without requiring a full JavaScript framework like React or Vue. Blocks declare interactivity using HTML data attributes called directives: data-wp-interactive marks the root element of an interactive namespace, data-wp-bind connects HTML attributes to state values, data-wp-on attaches event listeners, data-wp-text renders text content from state, and data-wp-class conditionally adds CSS classes. State and actions are defined in a companion JavaScript file using the store() function from @wordpress/interactivity. The Interactivity API is the official recommended approach for interactive block features like accordions, tabs, live filters, and cart interactions — replacing the previous pattern of each plugin bundling its own JavaScript framework.
Glossary entry