Remove “_” custom fields from data source list in facet settings and listing builder items

<?php
/**
 * removes all sources that are custom fields with "_" named meta_key
 * from data sources in Facet settings
 * keys in sources include "custom_fields", "posts, "taxonomies"
 * integrations add "upt" for user post type fields, "woocommerce", "acf"
 * context is 'default' for facet settings, context would be 'builder' for layout builder items
 **/
add_filter( 'facetwp_facet_sources', function( $sources, $context ) {
    foreach ( $sources AS $key => $value ) {
        if ( "custom_fields" == $key && 'default' == $context ) {
            $choices = array_values( array_filter( $value['choices'], function( $value, $key ) {
                if ( str_starts_with( $key, "cf/_" ) ) {
                    return false;
                }
                return true;
            }, ARRAY_FILTER_USE_BOTH ) );
            $sources[$key]['choices'] = $choices;
        }
    }
    return $sources;
}, 10, 2 );