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
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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.