Appearance
Feeds Platforms
Feed platforms extend the abstract BaseFeed (app/Services/Platforms/Feeds/BaseFeed.php). As with reviews, the base class handles the shared lifecycle — auth handshake, settings, GDPR, and cron — while your subclass focuses on fetching and shaping feed items.
The contract
php
namespace WPSocialReviews\App\Services\Platforms\Feeds;
class MyFeed extends BaseFeed
{
public function __construct()
{
parent::__construct('myfeed'); // $platform slug
$this->cacheHandler = new CacheHandler($this->platform);
}
// Bind the platform's hooks (called at boot)
public function registerHooks()
{
parent::registerHooks();
// add_filter('wpsocialreviews/myfeed_feeds_limit', ...);
}
// Required since 4.4.0 — refresh the given expired caches.
public function updateCachedFeeds($caches)
{
foreach ($caches as $cache) {
// Build your own API calls here.
}
}
}Required methods 4.4.0
Breaking change in 4.4.0
updateCachedFeeds($caches) is now abstract public on BaseFeed. A subclass that does not declare it is a fatal error at class-declaration time:
PHP Fatal error: Class MyFeed contains 1 abstract method and must therefore be
declared abstract or implement the remaining methods (BaseFeed::updateCachedFeeds)Add the method with the exact signature public function updateCachedFeeds($caches). It returns nothing; each platform builds its own API calls to refresh the expired caches it is handed.
BaseFeed also declares a protected $cacheHandler property (CacheHandler|null). Each platform feed sets it in its own constructor — the base constructor does not, so a subclass that never assigns it will hit null in the refresh path. See Caching.
Methods the base class provides
| Method | Role |
|---|---|
registerHooks() | Bind settings, verification, and rendering hooks |
prepareAuth() / consumeAuth() | OAuth prepare/consume handshake |
persistAuthResult() / formatAuthResultForResponse() | Store & shape the connection result |
getAdvanceSettings() / saveAdvanceSettings() | Settings storage |
formatPlatformGlobalSettings() | Normalize global settings |
getGdprSettings() | GDPR/consent settings |
doCronEvent() | Scheduled refresh |
The Config companion
Feed platforms typically ship a Config.php alongside the feed class that handles credential verification and the connection form — for example Services/Platforms/Feeds/Facebook/{Config, FacebookFeed}.php. TikTok follows the same shape at Services/Platforms/Feeds/Tiktok/{Config, TiktokFeed, Helper}.php.
Registering it
php
add_action('wp_social_reviews_loaded_v2', function () {
(new \WPSocialReviews\App\Services\Platforms\Feeds\MyFeed())->registerHooks();
});
add_filter('wpsocialreviews/available_valid_feed_platforms', function ($platforms) {
$platforms[] = 'myfeed';
return $platforms;
});Tuning the feed
Feed platforms expose numerous filters for limits, API fields, and endpoints — e.g. wpsocialreviews/facebook_feeds_limit, instagram_feeds_limit, youtube_api_parts, and the common Common/FeedFilters.php set (feeds_by_popularity, feeds_by_random, responsive_post_count, include_or_exclude_feed, hide_feed). See Filter Hooks → API & Feed Tuning.
TikTok is a live example
Custom Feed for TikTok registers its feed platform by calling (new TiktokFeed())->registerHooks() and supplying connected sources via wpsocialreviews/get_connected_source_list. See Custom Feed for TikTok.

