Home Forums Add-ons Repeater Field Make a repeater field Read only after updating post


Make a repeater field Read only after updating post

  • Dear Friends

    i need to make a repeater text field “readonly”. the problem is if i use below code i can not write any thing in the field and save it.

    function disable_message_load_field( $field ) {
    $field[‘readonly’] = 1;
    return $field;
    add_filter(‘acf/load_field/name=message_box_message_content’, ‘disable_message_load_field’);

    i tried to use add_action(‘save_post’,’set_message_readonly’) to make it read only after saving post but didn’t work.

    Do you have any idea ?

  • If you want existing sub field to be read only while allowing new rows to be edited then you need to do this using JavaScript.

    See this post for more information There is code there that makes existing sub fields readonly and removes the ability to delete existing rows.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.