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;
    $message_sender = $current_user->display_name;
    update_field(‘message_sender ‘, $message_sender, $post_id);