WP优雅主题>隐藏tinymce按钮?

时间:2013-09-30 00:28:02

标签: wordpress themes

我在我的Wordpress网站上安装了一个优雅的主题,我想知道如何隐藏或删除由优雅主题(管理区域WP)生成的tinymce(thing)中的短代码按钮。我一直试图查找动作钩并删除它,并使用按钮的CSS,但没有任何帮助。关于如何从WP网站的后端删除这些小按钮的任何想法?

这是我发现的相关代码:

add_filter('mce_buttons', 'et_filter_mce_button'); 

add_filter('mce_external_plugins', 'et_filter_mce_plugin'); 

function et_filter_mce_button($buttons) { 
    array_push( $buttons, '|', 'et_learn_more', 'et_box', 'et_button', 'et_tabs', 'et_author' ); 
    return $buttons; 
}

2 个答案:

答案 0 :(得分:0)

创建pluginremove the filters

<?php
/**
 * Plugin Name: Remove ET MCE Buttons
 */

add_action( 'admin_init', 'remove_et_so_19084867' );

function remove_et_so_19084867() {
    remove_filter( 'mce_buttons', 'et_filter_mce_button' );
    remove_filter( 'mce_external_plugins', 'et_filter_mce_plugin' );
}

答案 1 :(得分:0)

来自Elegant Themes论坛的用户引用了这篇文章:https://wordpress.stackexchange.com/questions/103347/removing-buttons-from-the-editor并说:

将以下代码放在您的子主题functions.php中:

// HIDE TINYMCE CUSTOM BUTTONS

function tinymce_editor_buttons($buttons) {
return array();
}

function tinymce_editor_buttons_second_row($buttons) {
return array();
}

add_filter("mce_buttons", "tinymce_editor_buttons", 99);
add_filter("mce_buttons_2", "tinymce_editor_buttons_second_row", 99);

这将删除Divi和其他插件插入的所有按钮。如果您需要保留任何按钮,则可以在return array();内包含相应的ID。此外,如果您正在使用插件TinyMCE Advanced,标准按钮仍会保留在原位。