benecaster_get_license_plan()
benecaster_get_license_plan( int|string|null $show_context = null ): string
Returns which plan a show’s license is on. Reads from a local cache rather than calling the license server, so it is safe on every request — the value refreshes during the daily validation run.
Pass the show when you have one, such as the $show_uuid a license hook hands you. Without it, the function reads the license of the site’s first connected show. Every show on a site shares one license, so both answers are the same.
Use benecaster_is_premium() when all you need is paid-or-not. Use this when the answer differs by plan, and compare against the slug rather than trying to rank the string yourself.
Parameters
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
$show_context |
int|string|null |
null |
No | The show's post ID, or its _benecaster_show_uuid. Omit it, or pass null, to read the site's license. |
Return Value
Type:
string
The plan slug of the show's license, or an empty string when no license is active. One of free, starter, growth, pro, multi_show, studio. Note that an active free Launch plan returns free, not an empty string: an empty string means no license, which is not the same thing.
Example
// Enable a feature only on Growth or higher.
$plan = benecaster_get_license_plan( $show_id );
if ( in_array( $plan, [ 'growth', 'pro', 'multi_show', 'studio' ], true ) ) {
// Register the growth-tier feature.
}
Need this built rather than just documented? See our services →