是的,可以从tinyMCE中删除自定义颜色选项。
WordPress捆绑了一个tinyMCE插件来处理自定义颜色功能。这个tiny_mce_plugins
过滤器可用于删除此由键标识的捆绑插件colorpicker
.
请注意,删除“自定义颜色”选项不会影响用户使用默认色样选择颜色的能力。
/**
* Remove the Color Picker plugin from tinyMCE. This will
* prevent users from adding custom colors. Note, the default color
* palette is still available (and customizable by developers) via
* textcolor_map using the tiny_mce_before_init hook.
*
* @param array $plugins An array of default TinyMCE plugins.
*/
add_filter( \'tiny_mce_plugins\', \'wpse_tiny_mce_remove_custom_colors\' );
function wpse_tiny_mce_remove_custom_colors( $plugins ) {
foreach ( $plugins as $key => $plugin_name ) {
if ( \'colorpicker\' === $plugin_name ) {
unset( $plugins[ $key ] );
return $plugins;
}
}
return $plugins;
}