Support

Account

Home Forums ACF PRO Disable Remove "Saved" Repeater Rows Reply To: Disable Remove "Saved" Repeater Rows

  • Hi Dave,

    You can add setting to field by using the ‘acf/render_field_settings’ filter but I don’t know how to change the setting value on post save. I don’t think it’s the best solution but, according to the function I already used, this may works :

    1. Use the ‘prepare_field’ filter on one (or all) subfield to add a class (for example ‘saved_in_database‘) if the field[‘value’] is not empty.
    2. Add some JQuery with the ‘admin_footer‘ action to remove the “remove button” on the same row.

    To explain a bit more my proposal : The ‘prepare_field’ filter works when the value is already loaded from database, so if the field[‘value’] is not empty that’s means the row was already saved. By adding a class on your repeater subfields which are already saved in database you create some JQuery target. By using the ‘.closest()‘ and ‘.child()‘ Jquery method you can finaly target the ‘‘ of the rows which contain at least one saved subfield and ‘.remove()‘ it.

    Hope it’s help. Tell me if you need some code example.