Login

To vote or comment, enter your email and we'll send a magic link

1

Deep ACF Fields can't be indexed as of 4.0.8

closed

There is an issue with FacetWP_Integration_ACF::index_acf_values(). Fields of any significant depth - 3+ fields would be affected it looks like - will not have the correct $sub_field object retrieved.

I believe this line (95 in acf.php as of 4.0.8) is the problem:

$sub_field = get_field_object( $hierarchy[0], $object_id, false, false );

$hierarchy[0] is going to consistently get the field information for the second level (as an earlier array_shift() already removed the first element). This will only be correct if the field being indexed happens to be at the second level.

I haven't tested this extensively but I believe the correct call would be:

$sub_field = get_field_object( end( $hierarchy ), $object_id, false, false );

Whatever the final field in the hierarchy is, however deep it may be, that's the actual target value we want to get field info for.

1 year ago

Comments (1)

Hi Ben, We have looked into this issue, but we are not able to reproduce it. Tested with repeater fields until 5 levels deep (where the 5th level is a text field), and the right values are indexed. Please let us know more about the scenario in which you are seeing this.

1 year ago