Support

Account

Home Forums Add-ons Repeater Field Would like my repeater field to be read-only Reply To: Would like my repeater field to be read-only

  • hi @scwebstarters-dk

    You can use a filter to disable fields by name.. see an example below where I disable 2 fields… you can even disable by role/capabilities etc.

    
    <?php
    /* START: Makes the 'Customer Name' and 'Customer ID' fields in Users Read-Only */
    function cc_make_customer_name_and_id_fields_in_users_read_only( $field ) {
      $field['disabled'] = 1;
      return $field;
    }
    add_filter('acf/load_field/name=cc_customer_name_user', 'cc_make_customer_name_and_id_fields_in_users_read_only');
    add_filter('acf/load_field/name=cc_customer_id_user', 'cc_make_customer_name_and_id_fields_in_users_read_only');
    /* END: Makes the 'Customer Name' and 'Customer ID' fields in Users Read-Only */
    ?>

    More info on the filter used can be found here.