WordPress:如何在帖子编辑器中隐藏工具栏? [英] WordPress: how to hide toolbar in post editor?

查看:31
本文介绍了WordPress:如何在帖子编辑器中隐藏工具栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 WordPress 网站中有一个自定义帖子类型(产品).

I have a Custom Post Type (Products) in my WordPress web site.

这是一个 WooCommerce 产品,如果有必要知道的话.

This is a WooCommerce Product, if it's necessary to know.

我需要在添加产品页面上将工具栏 (1) 隐藏到 wp-editor 中.我还需要隐藏添加媒体"按钮 (2) 和视觉/文本"选项卡 (3).

I need to hide toolbar (1) into wp-editor on Add Product page. Also I need to hide "Add media" button (2) and "Visual/Text" tabs (3).

如何隐藏它们?

使用一些钩子将这个 WordPress 编辑器更改为具有相同名称"属性值的文本区域是否有意义?

Maybe it make sense to change this WordPress Editor to the textarea with the same value of "name" attribute with using of some hooks?

推荐答案

我找到了这个解决方案:

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?

这篇关于WordPress:如何在帖子编辑器中隐藏工具栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆