wp_interactivity_data_wp_context
wp_interactivity_data_wp_context ( $context, $store_namespace = '' )
Parameters:- (array) context The array of context data to encode.
- (string) store_namespace Optional. The unique store namespace identifier.
Returns:- (string) A complete `data-wp-context` directive with a JSON encoded value representing the context array and the store namespace if specified.
Defined at: - Introduced in WordPress: 6.5.0
- Deprecated in WordPress: —
Description
Generates a `data-wp-context` directive attribute by encoding a context
array.This helper function simplifies the creation of `data-wp-context` directives
by providing a way to pass an array of data, which encodes into a JSON string
safe for direct use as a HTML attribute value.
Example:
true, 'count' => 0 ) ); ?>>