Support

Account

Home Forums General Issues How to edit the ACF WYSIWYG block format options? Reply To: How to edit the ACF WYSIWYG block format options?

  • You can use JS for this.

    Here is how you can add JS:
    https://www.advancedcustomfields.com/resources/adding-custom-javascript-fields/

    And there is a JS filter for changing settings of tinymce (wysiwyg editor) before it’s initialized.
    https://www.advancedcustomfields.com/resources/javascript-api/#filters-wysiwyg_tinymce_settings

    And here is the final code. Just change ‘field_abcd123456’ to whatever is the key of your field.

    
    add_action('acf/input/admin_footer', function(){
        ?>
        <script>
    
            acf.addFilter('wysiwyg_tinymce_settings', function( mceInit, id, field ){
                if(field.get('key') !== 'field_abcd123456'){
                    return mceInit;
                }
                mceInit.block_formats = 'Paragraph=p;Heading 4=h4';
                return mceInit;
            });
    
        </script>
        <?php
    });