php 从wordpress tinyMCE编辑器中删除按钮
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 从wordpress tinyMCE编辑器中删除按钮相关的知识,希望对你有一定的参考价值。
/**
* Removes buttons from the first row of the tiny mce editor
*
*
* @param array $buttons The default array of buttons
* @return array The updated array of buttons that exludes some items
*/
add_filter( 'mce_buttons', 'mmi_remove_tiny_mce_buttons_from_editor');
function mmi_remove_tiny_mce_buttons_from_editor( $buttons ) {
$remove_buttons = array(
'alignleft',
'aligncenter',
'alignright',
);
foreach ( $buttons as $button_key => $button_value ) {
if ( in_array( $button_value, $remove_buttons ) ) {
unset( $buttons[ $button_key ] );
}
}
return $buttons;
}
/**
* Removes buttons from the second row (kitchen sink) of the tiny mce editor
*
*
* @param array $buttons The default array of buttons in the kitchen sink
* @return array The updated array of buttons that exludes some items
*/
add_filter( 'mce_buttons_2', 'mmi_remove_tiny_mce_buttons_from_kitchen_sink');
function mmi_remove_tiny_mce_buttons_from_kitchen_sink( $buttons ) {
$remove_buttons = array(
//'formatselect', // format dropdown menu for <p>, headings, etc
//'underline',
);
foreach ( $buttons as $button_key => $button_value ) {
if ( in_array( $button_value, $remove_buttons ) ) {
unset( $buttons[ $button_key ] );
}
}
return $buttons;
}
以上是关于php 从wordpress tinyMCE编辑器中删除按钮的主要内容,如果未能解决你的问题,请参考以下文章
WordPress从TinyMCE编辑器中删除按钮
php 在Wordpress帖子编辑器页面添加第二个TinyMCE编辑器。第二个编辑器看起来和功能完全像原始的编辑器一样
黄聪:wordpress如何扩展TinyMCE编辑器,添加自定义按钮及功能
小板邓:wordpress如何扩展TinyMCE编辑器,添加自定义按钮及功能
WordPress TinyMCE 编辑器增强技巧大全
tinyMCE.editors[] wordpress 4.8 未定义