且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

WordPress:如何在帖子编辑器中隐藏工具栏?

更新时间:2023-11-24 15:28:46

我找到了这个解决方案:

I have found this solution:

    function hide_toolbar_TinyMCE( $in ) {
        $in['toolbar1'] = '';
        $in['toolbar2'] = '';
        $in['toolbar'] = false;
        return $in; 
    }
    add_filter( 'tiny_mce_before_init', 'hide_toolbar_TinyMCE' );

但它隐藏了无处不在的工具栏,因为这是过滤器"而不是动作".如何仅在产品(自定义帖子类型)添加/编辑页面上隐藏它?

But it hide toolbar everywhere, because this is "filter" but not "action". How do I hide it only on Product (Custom Post Type) Add/Edit page?