Am I able to get ACF field values from an ACF options page when creating a field group? I thought I might be able to use a relationship field but that only gets pages, posts, etc. (not values from populated ACF fields).
Any help much appreciated.
Hi @friendofdog
I’m afraid you can’t do it by using the relationship field. To do it, kindly check this guide: https://www.advancedcustomfields.com/resources/dynamically-populate-a-select-fields-choices/. The guide is talking about the select field, but I believe you should be able to modify it for other fields too.
I hope this helps 🙂
The second example was all I needed! Thanks, it works now. Here’s what I ended up using:
function acf_load_color_field_choices( $field ) {
$field['choices'] = array();
$choices = get_field( 'colour_repeater', 'option', false );
if( have_rows( 'colour_repeater', 'options' ) ): while ( have_rows( 'colour_repeater', 'options' ) ) : the_row();
$choice = get_sub_field( 'colour_name', 'options' );
$field['choices'][$choice] = $choice;
$i++; endwhile; endif;
return $field;
}
add_filter( 'acf/load_field/name=colours', 'acf_load_color_field_choices' );