Skip to main content

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.

Code

<?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 →

Hooks Used

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