Skip to content

Platform Registry Filters โ€‹

These are the seams for adding a platform to the plugin's registries. Combine them with BaseFeed / BaseReview โ€” see Platform Services.

wpsocialreviews/available_valid_reviews_platforms โ€‹

wpsocialreviews/available_valid_reviews_platforms โ€” Register a reviews platform

When it runs: Applied wherever the plugin resolves the list of valid review platforms (many call sites in reviews handling). Add your platform's slug to make it recognized throughout.

Parameters:

  • $platforms (array): list of valid review-platform slugs.

Source: ReviewsTrait.php, Reviews/Helper.php, SettingsController.php, PlatformController.php, Models/Review.php

Usage:

php
add_filter('wpsocialreviews/available_valid_reviews_platforms', function ($platforms) {
    $platforms[] = 'myplatform';
    return $platforms;
});

wpsocialreviews/available_valid_feed_platforms โ€‹

wpsocialreviews/available_valid_feed_platforms โ€” Register a feed platform

When it runs: the feed-platform analog of the reviews filter above.

Parameters:

  • $platforms (array): list of valid feed-platform slugs.

Source: PlatformController.php, Models/Template.php

Usage:

php
add_filter('wpsocialreviews/available_valid_feed_platforms', function ($platforms) {
    $platforms[] = 'myfeed';
    return $platforms;
});

Pro template registries 4.4.0 โ€‹

Feed templates are keyed by name (template1, template2, โ€ฆ). Core resolves a Pro template key to a renderer supplied through a filter, not to a file it owns โ€” so a key must be advertised in the registry below and rendered by the matching HTML filter. Core checks both before routing (canRenderProTemplate()); advertising a key with no renderer would otherwise concatenate the unfiltered array and print the word Array.

wpsocialreviews/instagram_pro_templates โ€‹

wpsocialreviews/instagram_pro_templates โ€” Instagram template keys rendered by Pro

When it runs: Applied by InstagramTemplateHandler::getProTemplates() whenever core decides whether an Instagram template key belongs to Pro. Return the array of keys.

The default is an empty array: released Pro registers its own keys through this filter.

Parameters:

  • $templates (array): Instagram template keys, [] by default.

Source: app/Hooks/Handlers/InstagramTemplateHandler.php

Usage:

php
add_filter('wpsocialreviews/instagram_pro_templates', function ($templates) {
    $templates[] = 'template9';
    return $templates;
});

// Required โ€” without a renderer, core falls back to template1.
add_filter('wpsocialreviews/add_instagram_feed_template', function ($template_body_data) {
    return '<div class="wpsr-ig-template9">โ€ฆ</div>';
});

wpsocialreviews/facebook_pro_templates โ€‹

wpsocialreviews/facebook_pro_templates โ€” Facebook template keys rendered by Pro

When it runs: The Facebook analog of the filter above, applied by FacebookFeedTemplateHandler::getProTemplates().

The default is ['template2'], because older Pro releases ship template2 only. Add to the array rather than replacing it, or an installed Pro's own template stops rendering.

Parameters:

  • $templates (array): Facebook template keys, ['template2'] by default.

Source: app/Hooks/Handlers/FacebookFeedTemplateHandler.php

Usage:

php
add_filter('wpsocialreviews/facebook_pro_templates', function ($templates) {
    $templates[] = 'template9';
    return $templates;
});

The matching renderer is wpsocialreviews/add_facebook_feed_template โ€” see Rendering & Template HTML filters.

Other registry filters โ€‹

reviews_platforms ยท platforms ยท platform_icons ยท get_connected_source_list ยท duplicatable_review_platforms
FilterValueSource
wpsocialreviews/reviews_platforms$listPlatformManager.php
wpsocialreviews/platforms$all_platformsSchedulerHandler.php
wpsocialreviews/platform_icons$iconsPlatformManager.php
wpsocialreviews/get_connected_source_list$sourcesPlatformData.php (TikTok supplies its sources here)
wpsocialreviews/duplicatable_review_platforms$listRecommendationsController.php

Usage:

php
add_filter('wpsocialreviews/platform_icons', function ($icons) {
    $icons['myplatform'] = 'https://example.com/icon.svg';
    return $icons;
});

WP Social Ninja Developer Documentation