Skip to content

App & Admin Variable Filters โ€‹

These filters shape the data localized to the admin Vue SPA and the public-facing scripts, plus a few global lists.

wpsocialreviews/admin_app_vars โ€‹

wpsocialreviews/admin_app_vars โ€” Data passed to the admin Vue SPA

When it runs: Fires while the admin app boots, building the JS variables object localized to the SPA. Use it to expose your own settings to a custom admin extension.

Parameters:

  • $vars (array): the admin app variables.

Source: app/Hooks/Handlers/AdminMenuHandler.php

Usage:

php
add_filter('wpsocialreviews/admin_app_vars', function ($vars) {
    $vars['my_addon'] = [
        'nonce'   => wp_create_nonce('my_addon'),
        'enabled' => true,
    ];
    return $vars;
});

wpsocialreviews/frontend_vars โ€‹

wpsocialreviews/frontend_vars โ€” Data localized to public JavaScript

When it runs: fires while public assets are enqueued, building the JS object available to front-end scripts (feeds pagination, popups, etc.).

Parameters:

  • $vars (array): the front-end variables.

Source: app/Hooks/Handlers/ShortcodeHandler.php

Usage:

php
add_filter('wpsocialreviews/frontend_vars', function ($vars) {
    $vars['my_flag'] = true;
    return $vars;
});

Other app/admin filters โ€‹

allowed_html_tags ยท available_post_types ยท translation_strings_i18n
FilterValueSource
wpsocialreviews/allowed_html_tags$tagsServices/Helper.php
wpsocialreviews/available_post_types$listServices/Helper.php
wpsocialreviews/translation_strings_i18n$mergedTranslationString.php

Usage:

php
add_filter('wpsocialreviews/available_post_types', function ($list) {
    $list[] = 'my_cpt';
    return $list;
});

WP Social Ninja Developer Documentation