Skip to main content

benecaster_addon_is_active_for_any_show()

Utilities Free
benecaster_addon_is_active_for_any_show( string $addon_slug ): bool

The install-wide counterpart to benecaster_addon_is_active(), mirroring benecaster_any_show_is_premium(). For callers that have no show in hand.

false when no show on the install is connected. Nothing is answered from the cached site-wide list in that state: that list is only a record of the last successful license check, and nothing rewrites it once the last show is disconnected. An install that has never connected has nothing in it anyway, so nothing that used to work stops.

For a site-wide add-on (registered with scope: 'site'; see benecaster_register_addon()), the answer comes from the grant alone: true when any connected show’s license grants it, since there is no per-show switch to consult.

false for every add-on once the license server has been unreachable for 30 days, site-wide add-ons included, exactly as for benecaster_addon_is_active(). The next successful license check restores every grant. LicenseManager::hard_limit_in_force() reports the state.

Parameters

Name Type Default Required Description
addon_slug string — Yes Add-on slug, e.g. 'analytics-dashboard'.

Return Value

Type: bool

true when the add-on is active on at least one connected show on this install.

Example

// Boot time has no show in hand, so this is the correct question here —
// it registers machinery, it does not decide who may see data.
add_action( 'benecaster_boot', function (): void {
    if ( ! benecaster_addon_is_active_for_any_show( 'analytics-dashboard' ) ) {
        return;
    }
    my_addon_register_export_sheet();
} );

Notes

THIS PAGE EXISTS FOR ONE WARNING, so read it before the signature. *"Some show on this install has the add-on" is not an answer to "may this show use it."*

**Substituting this for the per-show call hands one customer's paid feature to another customer's show.** A WordPress install can carry more than one license; a show entitled under license A does not entitle a show under license B. This function answers a question about the install, and the per-show call answers a question about entitlement. They are not interchangeable and the difference is invisible in testing on a single-show site — which is exactly why it needs saying here.

Legitimate uses are install-wide only:

- boot-time registration of hooks, CPTs, or routes - deciding whether to enqueue an admin asset at all - telemetry and aggregate reporting

**Never use it to gate content a subscriber sees, and never as a convenience to avoid threading a $show_id through your own code.** If you are reaching for it because the context is awkward to pass, pass the context.

Where a per-show gate belongs even inside a site-wide branch: register your machinery on the site-wide answer, then gate the actual data on benecaster_addon_is_active() per row or per request.

Need this built rather than just documented? See our services →