Home Forums Add-ons Repeater Field prevent remove or edit fields after update post


prevent remove or edit fields after update post

  • Dear Friends,
    I have a repeater field ” Message Content “, i need that a user role can add row and fill it, but after updating post he couldn’t remove or edit filled row. it will use as a reporting system.

    How can i do it ?


  • This has to be done with JavaScript, what you need to do is physically remove the delete row buttons. See this document on adding custom JS

    The following code is copied directly, it removes the delete row button from several repeaters. It leaves the delete row button if another field in the row is set to “0”. You’ll probably want to remove that check. This does allow the rows to be reordered. You might want to figure out how to remove the element that allows dragging the rows and quite possibly adding a row between other rows. But this is a starting point

    jQuery(document).ready(function($) {
      if (typeof(acf) == 'undefined') {
      // readonly existing values and remove the remove row link
      var repeaters = [
      var selectors = [];
      for (i=0; i<repeaters.length; i++) {
        selectors[selectors.length] = '[data-key="'+repeaters[i]+'"] .acf-row';
      var selector = selectors.join(', ');
      $(selector).each(function(index, element) {
        if ($(element).hasClass('acf-clone')) {
        $(element).find('.acf-input input').attr('readonly', true);
        if ($(element).find('[data-name="product_count"] .acf-input input').val() == '0') {
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.