Skip to main content

benecaster_episode_custom_fields

Filter Free

The unified custom fields filter — returns identical structure whether data comes from Benecaster built-in fields or ACF (Advanced Custom Fields, a popular WordPress plugin for defining structured post metadata). Template and RSS code always use this filter rather than reading post meta directly.

Return the array. Cast with (array). Each item is a group-shaped array with three keys: group (the group row), fields (its field definitions) and values (an associative map of stored values).

Returning an empty array suppresses the custom-fields section entirely — the template returns. That is the supported way to hide it conditionally.

This filter is display-only: it changes what the episode page renders and writes nothing. It does not affect the RSS feed, and it is not a way to set field values — there is no public setter for those today.

Parameters

Name Type Default Description
$fields array Array of custom field objects {label, type, value}
$episode_id int ID of the episode

Returns: array

Example

add_filter( 'benecaster_episode_custom_fields', function( $fields, $episode_id ) {
    // Inject a read-only "Recording location" field from ACF.
    $location = get_field( 'recording_location', $episode_id );
    if ( $location ) {
        $fields[] = [
            'label' => 'Recording Location',
            'type'  => 'text',
            'value' => $location,
        ];
    }
    return $fields;
}, 10, 2 );

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