Support

Account

Home Forums Front-end Issues Custom settings

Solved

Custom settings

  • Hi I have successfully added a custom text box setting and associated it to a radio button as per the below documentation: https://www.advancedcustomfields.com/resources/adding-custom-settings-fields/

    i can display the value by using the get field object:

    get_field_object($name);
    $customFieldValue = $getCurrentObject['custom_field'];
    echo $customFieldValue;

    I want to update the new custom text box field programatically in a similar way as you would the value of the radio button:

    update_field( $key, $value, $postId);

    The above would be used to update the values of the radio field options, but how can i update the value of the custom text field “custom_field”?

    Any help appreciated, Thanks in advance

  • Finally got it by using:
    $value = “My new value”
    $field = get_field_object(‘name_of_field’,$postId);
    $field[‘custom_field_name’] = $value;
    acf_update_field($field);

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

You must be logged in to reply to this topic.

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.