WPDev.one
Core Function
View Source on Trac ↗

wp_interactivity_data_wp_context()

wp_interactivity_data_wp_context( array $context, string $store_namespace = '' )

Generates a `data-wp-context` directive attribute by encoding a context

Parameters 1 required

Name / Type Description
$context
array

The array of context data to encode.

Required
$store_namespace
string

Optional. The unique store namespace identifier.

Return Value

(string)
string A complete `data-wp-context` directive with a JSON encoded value representing the context array and the store namespace if specified.

Function Information

Since Version
6.5.0
Source File
wp-includes/interactivity-api/interactivity-api.php
Advertisement