Disabling some buttons from wp_editor

徘徊边缘 提交于 2019-12-13 05:18:56

问题


I use tinyMce editor in meta boxes of Wordpress by the following line of code, I want to remove some buttons when I use there. I don't want to affect the main editor. I know how to remove some buttons, which is told here.

My question is, is it possible to disable some buttons (e.g. more) when I call editor with wp_editor. I checked its manual, arguments doesn't seem to support this.

wp_editor( $careers_settings["description"], "editor", array("media_buttons"=>FALSE,  "textarea_name"=>"description", "textarea_rows"=>5) );

Thank you.


回答1:


You should check the referenced manual again - it's possible to have tinymce as parameter and pass an array of configuration options, e.g. like

wp_editor($value, "input...", array(
    'tinymce' => array( .. //tinymce configuration options here )
     ))

Haven't tried it out, but it should work like that.




回答2:


I guess it's a bit late to answer but in case it might be useful for someone. Since Tinymce 4, "toolbar1" must be used and "teeny" must be set as false to modify buttons :

wp_editor(
'id',
'value',
array(
  'teeny'=>false,
  'media_buttons'=>false,
  'tinymce' => array(
    'toolbar1' => 'bold, italic, underline,|,fontsizeselect',
    'toolbar2'=>false
  ),
)
);

Also I added "toolbar2" to the array. I realized that although I only set toolbar1, additional buttons still appear in some cases. Setting toolbar2 as false will remove default buttons on the second buttons row.



来源:https://stackoverflow.com/questions/25752620/disabling-some-buttons-from-wp-editor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!