Discuss your project
Wordpress Backoffice

WordPress: Change the default colors of the WordPress HTML editor

To change the default colors available in the WordPress WYSIWYG editor, simply add the following code to the functions.php file: // change buttons in WYSWIG post editor, edit color palette function change_mce_options( $init ) { $init['theme_advanced_text_co...

WordPress: Change the default colors of the WordPress HTML editor

To change the default colors available in the WordPress WYSIWYG editor, simply add the following code to the functions.php file:

// change buttons in WYSWIG post editor, edit color palette
function change_mce_options( $init ) {
$init['theme_advanced_text_colors'] = 'd21268,146c52,82b600,00949b,010080,001c4b';
$init['theme_advanced_more_colors'] = true;
return $init;
}

add_filter('tiny_mce_before_init', 'change_mce_options');

Reproduce this customization today

The principle of the hook remains useful, but the administration screens and WordPress APIs have evolved since the publication. Test the code in a staging environment with the exact version of the site's core, theme, and plugins.

  • Save the files and the database before making any changes.
  • Control user capabilities, nonces, input validation, and output escaping.
  • Place customizations in a dedicated plugin or a child theme to preserve updates.

Reference: official WordPress plugin development manual.

Share this article