Home › Forums › Add-ons › Repeater Field › Disabled/ReadOnly Field in repeater › Reply To: Disabled/ReadOnly Field in repeater
Hi
You can use this code :
function disable_message_load_field( $field ) {
$field[‘readonly’] = 1;
return $field;
}
add_filter(‘acf/load_field/name=sub_field_1’, ‘disable_message_load_field’);
add_filter(‘acf/load_field/name=sub_field_2’, ‘disable_message_load_field’);
to make your field read only. please note that disabled field are not saved and it is better to use radonly to keep your data.
for inserting current user info in sub field you can use this code:
global $current_user;
get_currentuserinfo();
$message_sender = $current_user->display_name;
update_field(‘message_sender ‘, $message_sender, $post_id);
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.