Skip to content

Instantly share code, notes, and snippets.

@mishterk
Last active August 10, 2023 20:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mishterk/629ee7b470f973380c2f7fe8525efcd3 to your computer and use it in GitHub Desktop.
Save mishterk/629ee7b470f973380c2f7fe8525efcd3 to your computer and use it in GitHub Desktop.
Easily register custom toolbars for ACF's WYSIWYG field. More info: https://philkurth.com.au/articles/customise-acfs-wysiwyg-field-toolbars-for-a-simpler-admin-experience/
<?php
add_filter( 'acf/fields/wysiwyg/toolbars', function ( $toolbars ) {
// Register a basic toolbar with a single row of options
$toolbars['Custom One'][1] = [ 'bold', 'italic', 'underline', 'forecolor', 'link', 'unlink' ];
// Register another toolbar, this time with two rows of options.
$toolbars['Custom Two'][1] = [ 'bold', 'italic', 'underline', 'strikethrough', 'forecolor', 'wp_adv' ];
$toolbars['Custom Two'][2] = [ 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright' ];
return $toolbars;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment