Home › Forums › General Issues › Issue: WPML support: using repeatable fields in option fields › Reply To: Issue: WPML support: using repeatable fields in option fields
Some more information to add which is missing in the answer above:
This error only happens when you try to access all options at once using get_fields()
.
Elliot meant that he can’t think of a quick and easy bug fix for this.
However, there’s a workaround, where you don’t use get_fields()
, but get_field()
for every repeater. To still have them all accessible in one place, you can do something like this:
// Put all repeater field names you have in your options fields in an array
$options_repeater_names = array(
'options_repeater_name_1',
'options_repeater_name_2',
'options_repeater_name_3',
);
$options_repeaters = array();
// Loop through repeater field names and use get_field separately for each repeater field
foreach ( $options_repeater_names as $field_name ) {
$options_repeaters[ $field_name ] = get_field( $field_name, 'options' );
}
// Now all the repeaters are accessible in $options_repeaters
Good luck!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.