ACF – set “Other data source” equal to “Data source” if empty

mgibbs189

{{gist file=”functions.php” lang=”php”}}
<?php

// Add to your (child) theme’s functions.php

add_filer( ‘facetwp_acf_display_value’, function( $value, $params ) {
if ( ! empty( $params[‘facet_name’] ) ) {
$facet = FWP()->helper->get_facet_by_name( $params[‘facet_name’] );
if ( ! empty( $facet[‘source_other’] ) && empty( $value ) ) {
$value = $params[‘facet_value’];
}
}
return $value;
}, 20, 2 );
{{/gist}}