テキストエディタからプラグインによって追加されたボタンを削除する
テキストエディタからプラグインによって追加されたボタンを削除するには下記のようにします。
(例: 「Post Snippets」「Crayon Syntax Highlight」のプラグインで追加されるボタンを削除する)
1. テーマのfunctions.phpに、下記のように記載します。
1 2 3 4 5 |
function custom_remove_plugin_quicktags() { // テキストエディタ側で不要なボタンの削除などを行うCSSを追加します。 wp_enqueue_style( 'custom-editor-button-style', get_template_directory_uri() . '/custom-editor-button.css' ); } add_action( 'admin_init', 'custom_remove_plugin_quicktags' ); |
2. テーマのフォルダにCSSファイル(上の例だとcustom-editor-button.css)を追加します。
3. 2.のファイルに下記のように記載します。
1 2 3 4 |
/* Post Snippetsプラグインのボタン */ #qt_content_post_snippets_id { display: none } /* Crayon Syntax Highlightのボタン */ #qt_content_crayon_quicktag { display: none } |
ボタンのIDが分かれば、「qt_content_post_snippets_id」の部分を変更することで別のプラグインのボタンを削除することもできます。