Filter: um_frontend_common_js_variables

apply_filters( 'um_frontend_common_js_variables', $variables ) → {array}

Filters data array for localize frontend common scripts.

Parameters:
Name Type Description
$variables array

Data to localize.

Since:
  • 2.8.0
Source:
Returns:

Data to localize.

Type
array
Example

Add `my_custom_variable` to common frontend scripts to be callable via `um_frontend_common_variables.my_custom_variable` in JS.

function um_custom_frontend_common_js_variables( $variables ) {
    $variables['{my_custom_variable}'] = '{my_custom_variable_value}';
    return $variables;
}
add_filter( 'um_frontend_common_js_variables', 'um_custom_frontend_common_js_variables' );