Home Forums Add-ons Options Page Update existing select values into database when options page is saved


Update existing select values into database when options page is saved

  • Hi there,
    First of all, thanks for this awesome plugin 🙂

    I followed the tutorial to dynamically populate a select field with an repeater on an option page and it works great. The repeater populate a select containing a list of sellers in posts.

    The value selected in the select field is correctly saved into the database. But, when I update a value in the repeater, this value is not changed into the database for the existing posts.

    Here is the code I tried :

    function my_acf_load_field($field) {
        $field['choices'] = array();
        if( have_rows('revendeur_repeater', 'option') ) {
             while( have_rows('revendeur_repeater', 'option') ) {
                $label = get_sub_field('nom_revendeur');
                $value = get_sub_field('abv_revendeur');
    	    $field['choices'][ $value ] = $label;
    	return $field;
    add_filter('acf/load_field/name=partenaire_vente', 'my_acf_load_field');
    function my_acf_update_value( $value, $post_id, $fields  )
        $value = $field;
        return $value;
    add_filter('acf/update_value/name=partenaire_vente', 'my_acf_update_value', 10, 3);

    So my question is : Is there a way to also update the selected value saved for a post when the option page is saved ?

    Thanks in advance 🙂

  • Hi @piloum,

    Thanks for the post.

    This is quite odd, the values should automatically get updated once the page is saved.

    I would like to know whether the right value is returned when you var_dump() the value of the field on the options page.

    $value = get_field('field_name', option);
    echo '<pre>';
    	var_dump( $image );
    echo '</pre>';
  • Howdy, is there any update on this?

    I am in the same situation with the exact type of problem. To clarify when I update the repeater field on the Options page it dynamically populates my select fields correctly, but in order to make sure the new value is saved on the page itself where I have the select field I have to go back in and update the actual page itself. If I have the same select field with those same select options on several pages, say for a button, and I decide to change the color of the button, I will have several pages to go in and update if I ever change a value. Is there a way where if I change the value in the Repeater field on the Options page it automatically updates the values on the select fields without me having to go in and update each page manually?

  • Hi @tjmorris81 ,

    Please open a new support ticket for this issue so that we can be able to provide more personalised support at

    Hope to hear from you soon.

  • Hi James,
    Thanks for your response! Yes, I did start a new topic already, should have updated this forum, you can find it here:


  • Do you still want me to fill out the support ticket, or leave it in the new forum topic I started?

  • Hi @tjmorris81 ,

    Thanks for the follow up.

    If you are stuck with the issue, kindly send us a support request at [email protected].

    Hope to hear from you soon.

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Update existing select values into database when options page is saved’ is closed to new replies.