Home › Forums › Backend Issues (wp-admin) › Relationship field – get ACF field values from custom options page › Reply To: Relationship field – get ACF field values from custom options page
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' );
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!
Make sure to register for tomorrow’s special ACF-focused edition of #BuildModeLive. Iain Poulson joins @hellosammunoz & @bgardner for a discussion about ACF’s roadmap and what’s in development. https://t.co/k93h4pYCae
— Advanced Custom Fields (@wp_acf) January 26, 2023
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.