Home Forums Bug Reports value for acf_render_field_setting being overwritten Reply To: value for acf_render_field_setting being overwritten

  • Hi John,

    When you don’t setup a default, the first option will be selected. That is not the problem.

    The problem is, that when i save the field (the field itself works fine), the value is correctly passed through. I’ve tested this on 5.3.5 and it works fine there.

    The value attribute should hold the SELECTED option. So, when you save a post and this custom ACF field is on there, the value is saved in the meta and is returned correctly when i fetch it using get_field(‘report_type’). BUT, the selected=”selected” is not add to the option which is selected. This is caused by the bug which is in the first post:
    the value is overwritten due to a mis-design. If you program something to check for “isset” and it IS SET, but has no value, it still is set. Therefor it will ALWAYS resort back to the default_value.

    If i understand you correctly, you are suggesting that i should use the default_value option to get the correct <option> the selected=”selected” attribute. That would be a big design flaw in my opinion.

    If you can debug the acf_render_field_setting function in the ACF PRO plugin and insert an array into the $settings (second attribute) variable, you can see what i mean.