Skip to main content

benecaster_privacy_policy_sections

Filter Free

Filters the array of suggested privacy-policy sections Benecaster contributes on Settings → Privacy → Policy Guide via wp_add_privacy_policy_content(). Fires on admin_init, immediately before Privacy\PrivacyPolicyContent combines the sections into one HTML blob and passes it to wp_add_privacy_policy_content( 'Benecaster', $html ).

Each core entry is gated on the feature it describes actually being active on the install — download logging, Listener Support donations, built-in membership, follower signup, email logging — so an add-on callback should apply the same discipline: check its own real setting before appending a section, and never emit one unconditionally. A callback may also remove or replace a core entry (filter $sections by heading) — useful for a membership add-on that wants different wording for its own subscribers.

If the filtered array is empty (or every entry’s content is blank), wp_add_privacy_policy_content() is never called at all — there is no way to force an empty call.

Add your add-on's own paragraph to Benecaster's suggested privacy-policy text

Free Beginner

Core’s Privacy\PrivacyPolicyContent (registered on admin_init) contributes suggested privacy-policy paragraphs under Settings → Privacy → Policy Guide, one per Benecaster feature that is actually active on the install — download logging, Listener Support donations, built-in membership, follower signup, email logging. Nothing is emitted for an inactive feature: a paragraph describing data an install never collects would make the podcaster’s own privacy policy claim something untrue about their site.

This filter is the extension point for exactly that same discipline. It runs on the array of {heading, content} sections just before they are combined into the one HTML blob WordPress reads, so an add-on can both append its own section and gate it on its own real setting — never unconditionally.

A callback may also remove a core entry — filter $sections by heading before returning — for an add-on whose own paragraph supersedes core’s wording (e.g. a membership add-on that wants different phrasing for its own subscribers). The final HTML is what actually reaches wp_add_privacy_policy_content(); nothing about the internal array survives past this filter.

<?php
add_filter( 'benecaster_privacy_policy_sections', function ( array $sections ): array {
    // Gate on your OWN add-on's real setting -- never emit unconditionally.
    if ( ! get_option( 'my_addon_transcription_enabled', false ) ) {
        return $sections;
    }

    $sections[] = [
        'heading' => __( 'Episode Transcripts', 'my-addon' ),
        'content' => __( 'When transcription is enabled, we send episode audio to our transcription provider to generate a text transcript, which is stored alongside the episode.', 'my-addon' ),
    ];

    return $sections;
} );

View on GitHub →

Parameters

Name Type Default Description
$sections array The sections core has determined are active on this install.

Returns: array

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