helpful_frontend_ajax_vars

This filter can be used to pass variables to the Helpful javascript, or manipulate existing variables from Helpful.

/**
 * @param array $vars
 * @return array
 */
add_filter('helpful_frontend_ajax_vars', function (array $vars) {
    $vars['my_var'] = 'some nice content';
    return $vars;
});

Afterwards the variable is available in JavaScript with: helpful.my_var

Was this post helpful?

Top