relevanssi_custom_fields_before_repeaters

apply_filters( 'relevanssi_custom_fields_before_repeaters', array $custom_fields )

Filters the custom field array before the ACF repeaters and flexible fields are expanded.

Parameters

$custom_fields
(array) An array of custom field names (strings).

More information

Relevanssi already has relevanssi_index_custom_fields that lets you modify the list of custom fields Relevanssi indexes. However, this filter hook has a shortcoming when it comes to ACF repeaters and flexible content fields: it runs after Relevanssi expands the field_%_subfield notation to actual field names. That’s also good, because you can modify those expanded field names, but if you want to add flexible content fields from code, that’s not very convenient.

This new filter hook is for this very purpose: you can use this filter hook to add custom field names from code using the field_%_subfield notation and then have Relevanssi expand those wildcard field names to actual field names (which you can then filter with relevanssi_index_custom_fields if need be).

add_filter( 'relevanssi_custom_fields_before_repeaters', 'rlv_add_repeater_fields' );
function rlv_add_repeater_fields( $custom_fields ) {
  $custom_fields[] = 'student_%_name';
  $custom_fields[] = 'student_%_major';
  return $custom_fields;
}