How do you add Text Color Button to Advanced Custom Fields TinyMCE Basic toolbar?

By default ACF has two choices for the WYSIWYG custom field regarding toolbars, Full and Basic. These are both great but I just need one more button( maybe more in another project) in the Basic toolbar.

I am trying to add the text-color picker to the Basic toolbar.

Read More

Based on this documentation here, ACF Documentation, I came up with this:

add_filter( 'acf/fields/wysiwyg/toolbars' , 'my_toolbars'  );
function my_toolbars( $toolbars ) {
    array_unshift( $toolbars['Basic' ] , 'forecolor' );
    return $toolbars;
}

I also looked at this past question,“How to add a button to ACF tiny MCE editor”, but didn’t find the links provided very clear in producing a result(maybe partially because comments were in French).

I am guessing it has something to do with what was said in that questions comments about missing the plugin for that button. But I am unsure, any solutions?

Related posts

Leave a Reply

1 comment

  1. With some help from the Advanced Custom Fields Support Forum, I found out that my code was prepending to the outer array and I needed to target the nested array to add the button.

    This is the code that works to add the Font Color button to the Basic Toolbar:

    add_filter( 'acf/fields/wysiwyg/toolbars' , 'my_toolbars'  );
    function my_toolbars( $toolbars ) {
        array_unshift( $toolbars['Basic' ][1], 'forecolor' );
        return $toolbars;
    }