Home Forums Add-ons Repeater Field Collapse specific Repeater fields by default


Collapse specific Repeater fields by default

  • Hi, I know this topics has passed before but I would like to know how to collapse specific groups of repeater fields by default.. I have this snipped which closes all repeater fields.
    Any thoughts on this? Thanks in advance.

    // Collapse ACF Repeater by default
    add_action('acf/input/admin_head', 'wpster_acf_repeater_collapse');
    function wpster_acf_repeater_collapse() {
    <style id="wpster-acf-repeater-collapse">.acf-repeater .acf-table {display:none;}</style>
    <script type="text/javascript">
    	jQuery(function($) {
    		$('.acf-repeater .acf-row').addClass('-collapsed');
  • You would need to target the specific rows. For example:

    // target all except 1st row
    $('.acf-repeater .acf-row+.acf-row').addClass('-collapsed');

    More than this I’d need more specifics on what your criteria is for collapsing a row.

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.