Title: WP_Interactivity_API::add_hooks
Published: April 3, 2024
Last modified: February 24, 2026

---

# WP_Interactivity_API::add_hooks()

## In this article

 * [Source](https://developer.wordpress.org/reference/classes/wp_interactivity_api/add_hooks/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_interactivity_api/add_hooks/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_interactivity_api/add_hooks/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_interactivity_api/add_hooks/?output_format=md#wp--skip-link--target)

Adds the necessary hooks for the Interactivity API.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_interactivity_api/add_hooks/?output_format=md#source)󠁿

    ```php
    public function add_hooks() {
    	add_filter( 'script_module_data_@wordpress/interactivity', array( $this, 'filter_script_module_interactivity_data' ) );
    	add_filter( 'script_module_data_@wordpress/interactivity-router', array( $this, 'filter_script_module_interactivity_router_data' ) );
    	add_filter( 'wp_script_attributes', array( $this, 'add_load_on_client_navigation_attribute_to_script_modules' ), 10, 1 );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/interactivity-api/class-wp-interactivity-api.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/interactivity-api/class-wp-interactivity-api.php#L384)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/interactivity-api/class-wp-interactivity-api.php#L384-L388)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_interactivity_api/add_hooks/?output_format=md#related)󠁿

| Uses | Description | 
| [add_filter()](https://developer.wordpress.org/reference/functions/add_filter/)`wp-includes/plugin.php` |

Adds a callback function to a filter hook.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_interactivity_api/add_hooks/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.9.0](https://developer.wordpress.org/reference/since/6.9.0/) | Adds support for client-side navigation in script modules. | 
| [6.5.0](https://developer.wordpress.org/reference/since/6.5.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_interactivity_api%2Fadd_hooks%2F)
before being able to contribute a note or feedback.