Skip to main content

Admin Extension Points

Required add-on: Core

Benecaster exposes a structured set of extension surfaces for add-ons to add UI, configuration, and behavior to the admin — without patching core files or fighting with WordPress hooks. There are two tiers: a PHP-only tier for field-based configuration, and a React SlotFill tier for interactive components.


Two Tiers of Admin Extension

Tier 1 — PHP Filter (Fields Only)

Declare tabs, settings pages, and dashboard cards using PHP arrays. No JavaScript required. Benecaster core renders the UI automatically from the declaration.

Use Tier 1 when your add-on needs to collect structured configuration data (toggles, text inputs, selects) that stores as episode meta or show options. It’s the right starting point for most add-ons.

Tier 2 — React SlotFill (Interactive Components)

Fill a named slot with a React component compiled into your add-on’s JavaScript bundle. Use Tier 2 when your UI needs state, effects, third-party widget embeds, live previews, or custom pickers that can’t be expressed as field declarations.

The two tiers are complementary. A common pattern: declare a tab shell with a Tier 1 PHP filter (so the tab appears in the sidebar nav), then fill its content with a Tier 2 React component.


PHP Extension Filters

benecaster_episode_editor_tabs

Adds tabs to the episode editor sidebar. Each tab declaration includes an id, label, optional icon, and a sections array of field declarations. Fields with meta: true are stored as episode post meta automatically.

Full spec, field types, and example: benecaster_episode_editor_tabs · add-episode-editor-tab-via-php


benecaster_settings_pages

Adds a custom page to the show settings left navigation. The page can be field-only (Tier 1) or rendered by a React component via the BenecasterSettingsPage_{id} slot (Tier 2).

Full spec and example: benecaster_settings_pages


benecaster_settings_sections

Injects field sections into an existing settings page — either a core settings page (Subscription, General, etc.) or a page you declared via benecaster_settings_pages. Each section has an id, a page slug to attach to, a label, and a fields array.

Full spec: benecaster_settings_sections


benecaster_dashboard_cards

Adds cards to the Benecaster dashboard after the core stat cards. Cards render via the BenecasterDashboardCards SlotFill slot.

Full spec and example: benecaster_dashboard_cards · inject-react-component-into-slot


benecaster_managed_email_types

Registers a new email type with Benecaster’s email system. Every type returned by this filter appears as an editable template in the Email Editor add-on’s template manager. Core registers welcome, token_reset, and token_revoked at boot.

Full spec and example: benecaster_managed_email_types · register-email-type


benecaster_addon_setup_checks

Registers persistent admin setup notices for add-ons that require external configuration before functioning — API keys, OAuth connections, platform links. The notice appears on all wp-admin screens until all registered requirements pass. Dismissed notices re-surface after 7 days if requirements remain unmet.

Each requirement specifies: key (unique string), check (callable returning true when met), message (label shown while incomplete), action_label and action_url (CTA link in the notice), and optional requires (key of a prerequisite requirement within the same add-on — prevents cascading “incomplete” items when step B depends on step A).

Dismiss state is stored per-user in user meta (_benecaster_setup_notice_dismissed_{addon_slug}). The state auto-clears when all requirements pass — the notice stops appearing without the admin having to re-dismiss it.

add_filter( 'benecaster_addon_setup_checks', function ( array $checks ): array {
    $checks[] = [
        'addon_slug'   => 'my-addon',
        'requirements' => [
            [
                'key'          => 'api_key',
                'check'        => fn() => ! empty( get_option( 'my_addon_api_key' ) ),
                'message'      => 'Enter your My Service API key in My Addon settings.',
                'action_label' => 'Go to settings',
                'action_url'   => admin_url( 'admin.php?page=benecaster&tab=my-addon' ),
            ],
        ],
    ];
    return $checks;
} );

React SlotFill Slots

All slots are rendered unconditionally — they are simply empty when no add-on has registered a fill. Register fills after wp.domReady fires using window.BenecasterExtensions?.registerFill( slotName, Component ).

Slot name Location fillProps
BenecasterEpisodePrePublish Pre-publish panel in the episode editor (fires before Publish is confirmed) { episode_id, show_id }
BenecasterEpisodeEditorTab_{id} Episode editor tab panel (where {id} matches the tab’s id in benecaster_episode_editor_tabs) { episodeId, showId }
BenecasterEpisodeEditorAfterFields Below all fields in the episode editor { episodeId, showId }
BenecasterShowEditorAfterFields Below all fields in the show editor General section { showId }
BenecasterDashboardCards After core stat cards on the dashboard { showId }
BenecasterSettingsPage_{id} Full add-on settings page in the show settings nav { showId }
BenecasterSubscriberDetailAfter Below the token section in the subscriber detail slide-in panel { subscriberId, showId }

BenecasterEpisodePrePublish uses underscore-separated prop names (episode_id, show_id) unlike most other slots which use camelCase. This matches the PHP-side convention for episode and show IDs throughout the REST API.

For a complete SlotFill example covering tab injection and dashboard cards, see inject-react-component-into-slot.


Front-End Extension

benecaster_account_sections

Fires at the end of the [benecaster_account] shortcode output, after all core subscriber account sections (feed URL, QR code, app deep links). Hook here to append HTML sections to the subscriber-facing account page.

Full spec: benecaster_account_sections


Quick Reference

Surface Mechanism Where it appears
Episode editor sidebar tab benecaster_episode_editor_tabs filter Episode editor
Episode editor interactive tab BenecasterEpisodeEditorTab_{id} SlotFill Episode editor
Episode editor extra fields BenecasterEpisodeEditorAfterFields SlotFill Episode editor
Pre-publish panel BenecasterEpisodePrePublish SlotFill Episode editor
Show editor extra fields BenecasterShowEditorAfterFields SlotFill Show editor
Dashboard card benecaster_dashboard_cards filter + BenecasterDashboardCards SlotFill Dashboard
Add-on settings page benecaster_settings_pages filter + BenecasterSettingsPage_{id} SlotFill Show settings
Sections in existing settings page benecaster_settings_sections filter Show settings
Subscriber detail panel section BenecasterSubscriberDetailAfter SlotFill Subscriber list
Subscriber account page section benecaster_account_sections action Front-end account page
Email type registration benecaster_managed_email_types filter Email Editor
Add-on setup notices benecaster_addon_setup_checks filter All wp-admin screens (until configured)

See Also