Support

Account

Home Forums Add-ons Flexible Content Field How to hide delete button on layouts for non admin users? Reply To: How to hide delete button on layouts for non admin users?

  • Hi @bonjour

    I believe you can remove it by adding JS script using the acf/input/admin_footer hook like this:

    add_action('acf/input/admin_footer', 'my_acf_admin_footer');
    function my_acf_admin_footer() {
        
        ?>
        <script type="text/javascript">
        (function($) {
            
            $(document).ready(function(){
    
                $(".acf-fc-layout-controlls a[data-event='remove-layout']").parent().remove();
                
            });
            
        })(jQuery);    
        </script>
        <style type="text/css">
            
        </style>
        <?php    
        
    }

    I hope this helps 🙂