Override TinyMCE’s default colors in WordPress Classic Editor and Advanced Custom Fields WYSIWYG

Back to Blogs

I’ve been building out a few custom blocks for a client using Advanced Custom Fields (ACF) and needed to use the WYSIWYG field. Unfortunately, the default TinyMCE allows a person to choose just about any color. This freedom is great for some users, but for individuals and brands that want to stay true to their brand styles, limiting color options is the best solution.

This function solves that issue by limiting the default color palette to a set of specified colors. To customize colors, simply edit the colors in the $custom_colors variable. Include this function in your theme’s functions.php or create a new PHP file and include it in your functions.php file.