Home Forums General Issues Pre-populate radio button with CPTs? Reply To: Pre-populate radio button with CPTs?

  • Jez,

    If I am understanding you correctly, you have a Custom Field in CPT b and you want CPT a to have access to the options that are selected?

    To target a specific field in a CPT you would change this block

    $args = array(
    				'public' => true
    		$post_types = get_post_types($args);
    		foreach ($post_types as $post_type) {
    			if ($post_type !== 'attachment' && $post_type !== 'page')
    				$field['choices'][$post_type] = ucfirst($post_type);

    to something like

    $cpt_custom_field = get_field($cpt_id, 'the_name_of_the_specific_field');
    foreach ($cpt_custom_field['choices'] as $value=>$label) {
        $field['choices'][ $value ] = [ $label ];

    Or whatever you want to replace the information with. Nested repeater fields are slightly more complicated, but code examples for that are in the docs. You could create a colors array and assign the select to those, you can grab all post names from a CPT and assign those, etc. You just need to change the above code to match what you are loading into the choices field.