Skip to content

Core ↔ Pro Coupling ​

Pro and Custom Feed for TikTok are hook-driven add-ons. They never stand alone — both boot off the free core's bootstrap action and register their handlers onto core's hook seam. This page explains that contract so your own add-on can follow the same pattern.

The boot sequence ​

  1. Core fires the bootstrap action, passing the Application container:

    php
    // core boot/app.php
    do_action('wp_social_reviews_loaded_v2', $app);
  2. Pro (and TikTok) listen on it, instantiate their own Application($app), and fire their own loaded action:

    php
    // wp-social-ninja-pro.php
    add_action('wp_social_reviews_loaded_v2', function ($app) {
        // ...version gate (below)...
        $proApp = new \WPSocialReviewsPro\App\Application($app);
        do_action('wp_social_ninja_pro_loaded', $proApp);
    });
  3. Each add-on's Application::boot() simply requires its app/Hooks/actions.php, app/Hooks/filters.php, and app/Http/Routes/api.php — which register handlers onto core's wpsocialreviews/… hooks via $app->addAction() / $app->addFilter().

Because the add-on only runs from inside wp_social_reviews_loaded_v2, it inherently no-ops when core is absent.

The version gate ​

Pro declares a minimum core version and bails early if the active core is missing or too old:

php
define('WPSOCIALREVIEWS_CORE_MIN_VERSION', '4.5.0');

if ( !defined('WPSOCIALREVIEWS_VERSION')
     || version_compare(WPSOCIALREVIEWS_VERSION, WPSOCIALREVIEWS_CORE_MIN_VERSION, '<') ) {
    // Show an admin notice and return — NO Pro services register.
    return;
}

Core reciprocally declares WPSOCIALREVIEWS_PRO_MIN_VERSION, which is 4.5.0 as of the 4.5.0 release — the two move together.

Bump the gate when Pro calls new core code

Because the gate runs before any Pro service loads, a Pro release that calls a new core class must raise WPSOCIALREVIEWS_CORE_MIN_VERSION to the core version that ships that class. The gate then prevents Pro from ever loading against a core that lacks it — so you do not need scattered class_exists() guards inside Pro services.

The extension seams Pro uses ​

  • Rendering override — Pro hooks the same wpsocialreviews/{reviewer_*, tweet_*, youtube_*, instagram_*, facebook_*} template element actions, replacing core's free defaults with richer handlers. It also fulfills the add_*_template / render_tiktok_template HTML filters.
  • Platform registration — Pro injects platforms via available_valid_reviews_platforms and reviews_platforms.
  • Licensing — Pro's PluginManager fulfills the core wpsr_get_license / wpsr_activate_license / wpsr_deactivate_license filters.
  • Shared storage — Pro reads and writes the core wpsr_reviews, wpsr_review_forms, and wpsr_caches tables and uses core models/policies directly; it ships no migrations.

Cross-add-on coupling ​

When both Pro and Custom Feed for TikTok are active, Pro also hooks TikTok's custom_feed_for_tiktok/tiktok_* actions and filters to add Pro-only TikTok features (follow button, statistics, extra video API details). So Pro enhances TikTok output only when both plugins are present.

Custom Feed for TikTok's gate ​

TikTok uses the same pattern with its own constant:

php
define('CUSTOM_FEED_FOR_TIKTOK_MIN_WPSR_VERSION', '4.5.0');

An init-hooked check shows a dependency/outdated notice if core is absent or older, while the actual Application only boots from wp_social_reviews_loaded_v2.

WP Social Ninja Developer Documentation