Support

Account

Home Forums Add-ons Flexible Content Field Contract all flexible content fields by default Reply To: Contract all flexible content fields by default

  • Hi @bonjour

    I believe you can add a script to click the collapse button automatically when the page is loaded like this:

    add_action('acf/input/admin_head', 'my_acf_admin_head');
    function my_acf_admin_head() {
        
        ?>
        <script type="text/javascript">
        (function($) {
            
            $(document).ready(function(){
                
                $('.acf-field-flexible-content a.-collapse').click();
                
            });
            
        })(jQuery);    
        </script>
        <style type="text/css">
            
        </style>
        <?php    
        
    }

    I hope this helps 🙂