Home Forums ACF PRO Unable to delete hidden field Reply To: Unable to delete hidden field

  • as far as i understand:
    conditionally hiding save only visible field. that why it allows you to skip some “may required” fields. it never does or should delete saved values by switch condition.
    if you delete something and switch. delete is not saved because everything is only saved when it is visible and you click save.

    to be fair/true: 😉 your main problem is not hidden or not hidden, you try to delete a required field. and a required field is like a radio-button with 1 value. you cant deselect it once set. this is something that is not possible without additional coding or a workaround.

    one way to remove a value from DB set by required-field is:
    set it to not required, delete value, and save. after that set it back to required.
    but that is not practical 😉 and nothing a customer should be able to do.

    what (may) should work too is: duplicate image-field (same field-name!)
    show it at color but set it as not required. (set conditionals same as color)
    let original required at image conditional.
    if you switch from image to color: required image set by image is shown as not required at color. image can be deleted there because it is not required.
    with that it can be saved, but customer had to delete it manually.

    it may could work with a update_value filter and wp_update_post too

    but my advise: solve problem at save_post action or with flexible field