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
});
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.