Answers for "elasticpress acf"

0

elasticpress acf

/**
  * ElasticSearch: Modify available search fields
  */
  add_filter( 'ep_search_fields', function($search_fields, $args ) {
    $fields = ['my_field'];
    foreach($acf_fields as $key => $label) {
    $fields[] = 'meta.'.$key.'.value';
  }
  return array_merge( $search_fields, $fields );
 }, 10,2 );
Posted by: Guest on February-17-2021
0

elasticpress acf

add_filter( 'ep_search_fields', 'update_search_fields', 11, 2 );
/**
 * Updates fields to search against.
 *
 * @param array $fields List of searchable fields.
 * @param array $args List of arguments provided.
 *
 * @return array
 */
function update_search_fields( array $fields, array $args ): array {
    $fields[] = 'meta.mfr_part.value';

    return $fields;
}
Posted by: Guest on February-17-2021

Browse Popular Code Answers by Language