I am looking to have all flexible content fields contracted (hidden) by default when visiting a page. Any help at all greatly appreciated
This reply has been marked as private.
Hi James,
I’m also interested to know how to hide flexible content fields.
Thanks.
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 🙂