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

open

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.

2 months ago

Comments (0)