Support

Account

Home Forums Backend Issues (wp-admin) acf/load_field filter question Reply To: acf/load_field filter question

  • Actually, yes, it’s because of the repeater. As soon as I put the select field in a repeater it behaved the same way for me.

    Here’s how to fix it. Before returning the fields update the field and this will force ACF to save the new choices in the database.

    
      
      add_filter('acf/load_field/key=field_56abbdb4d9be3', 'dynamic_select');
      function dynamic_select($field) {
        //echo '<pre>'; print_r($field); echo '</pre>';
        $field['choices'] = array(
          'a' => 'A',
          'b' => 'B',
          'c' => 'C',
          'd' => 'D'
        );
        // save new field settings to db
        acf_update_field($field);
        return $field;
      }