Readonly Field

ACF to custom database tables plugin provides options to make an ACF field ready-only. Non-admin users can not update read-only field data.

To make the field read-only, edit field and toggle read-only button

acf custom table read only field

Use acf_ct/edit_read_only_field filter to allow non-admin user to update read-only fields.

add_filter(
  "acf_ct/edit_read_only_field",
  function ($is_read_only, $field) {
    /**
     * Admin and editor can edit read-only fields
     */
    if (current_user_can("administrator") || current_user_can("editor")) {
      return true
    }

    return $is_read_only
  },
  10,
  2
)

Upgrade to PRO