Customise ACF’s WYSIWYG field toolbars for a simpler admin experience

The ability to control exactly what buttons are available in a WYSIWYG field is a really neat point of customisation available in Advanced Custom Fields.

The WYSIWYG field is definitely convenient but I often find myself needing to use it for no other reason than the most basic of formatting. Leaving too many options in the toolbar means there is more markup possibilities for me to style and toolbars with too many options can often add unnecessary clutter where it isn’t needed.

Thankfully, Advanced Custom Fields has us covered with a convenient WordPress filter for customising the WYSIWYG field toolbars.

Defining custom WYSIWYG toolbars for Advanced Custom Fields

<?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;
} );

Defining your own toolbars couldn’t be simpler. With a snippet like this in place, you’ll have more toolbars to choose from when configuring WYSIWYG fields in your ACF field groups.

Custom toolbars in Advanced Custom Fields for WordPress

Got a project? Let's talk.

From website design & SEO through to custom WordPress plugin development. I transform ideas into dynamic, engaging, and high-performing solutions.
Subscribe to get the latest insights & updates in the world of web and how it impacts your business and website.
© 2024 Phil Kurth  |  All rights reserved.