Skip to content

Cache, Scheduler & Cron Actions โ€‹

WP Social Ninja caches remote responses and refreshes them on a WP-Cron schedule. These hooks let you react to cache purges and the per-platform refresh jobs. See Caching for the bigger picture.

wpsocialreviews/purge_cache โ€‹

wpsocialreviews/purge_cache โ€” The feed/review cache was cleared

When it runs: Fires when WP Social Ninja clears its cache (manually or programmatically) in Feeds/CacheHandler.php. The handler also integrates with common page caches (LiteSpeed, Nginx Helper, Breeze).

Parameters: none

Source: app/Services/Platforms/Feeds/CacheHandler.php

Usage:

php
add_action('wpsocialreviews/purge_cache', function () {
    // also bust your own CDN/page cache
    my_cdn_purge_tag('wpsn');
});

Per-platform cron jobs โ€‹

wpsr_{platform}_feed_update ยท wpsr_{platform}_reviews_update ยท wpsr_{platform}_send_email_report

When they run: On the plugin's WP-Cron schedule, when a platform's cache expires. Feed and review platforms each get a refresh action; some also send scheduled email reports.

HookPurpose
wpsr_{platform}_feed_updateRefresh a feed platform's data
wpsr_{platform}_reviews_updateRefresh a review platform's data
wpsr_{platform}_send_email_reportSend a scheduled email report

Source: app/Hooks/Handlers/SchedulerHandler.php

Usage:

php
// Force a Google reviews refresh (e.g. from WP-CLI or a custom trigger)
do_action('wpsr_google_reviews_update');
Token & AI-summary maintenance jobs
HookArgsPurpose
wpsr_instagram_access_token_refresh_weeklyโ€”Refresh the Instagram long-lived token
wpsocialreviews/check_instagram_access_token_validity_weekly$accountValidate an Instagram token
wpsocialreviews/regenerate_ai_summary_cacheโ€”Rebuild AI review summaries (Pro)

Source: app/Hooks/Handlers/SchedulerHandler.php

Per-platform cache clearing โ€‹

wpsocialreviews/clear_cache_{platform} โ€” Clear one platform's cache

When it runs: when the admin clears a single platform's cache.

Parameters:

  • $cacheType (string): which cache to clear.

Source: app/Http/Controllers/SettingsController.php

Usage:

php
add_action('wpsocialreviews/clear_cache_myplatform', function ($cacheType) {
    // remove your platform's cached rows
});

WP Social Ninja Developer Documentation