Title: Disable the TinyMCE Code Snippets Button/Dropdown
Last modified: December 12, 2022

---

# Disable the TinyMCE Code Snippets Button/Dropdown

 *  Resolved [codejp3](https://wordpress.org/support/users/codejp3/)
 * (@codejp3)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/disable-the-tinymce-code-snippets-button-dropdown/)
 * Quick Question:
 * How do I disable the TinyMCE addition for Code Snippets. I do not want it to 
   be displayed in the TinyMCE toolbar.
 * I recently setup a BBPress forum and went with a more advanced TinyMCE editor
   on the front end and do not want the Code Snippets button/dropdown included within
   the forum.
 * I’d prefer to disable it only on the front-end of the site, but I’m fine disabling
   it site-wide as well since I never seem to use it.
 * Can’t find any settings to disable it.
 * If need be, I’ll look through your code and see where you’re hooking into and
   deregister your hook, but thought I’d ask first.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [codejp3](https://wordpress.org/support/users/codejp3/)
 * (@codejp3)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/disable-the-tinymce-code-snippets-button-dropdown/#post-16279913)
 * Well, answered my own question.
 * Made this little snippet, and even kept BBPress context so it’s only disabled
   in the front end forum.
 *     ```
       add_filter( 'mce_buttons', 'codejp3_remove_code_snippets_button', 99 );
       function codejp3_remove_code_snippets_button( $buttons ) {
       	if ( is_bbpress() ) {
       		$buttons = array_diff($buttons, ["code_snippets"]);
       		return $buttons;
       	}
       }
       ```
   
 * I think adding a setting for this within the plugin is overkill, especially if
   you factor in context (like only on BBPress)…. BUT perhaps something like this
   should be a default sample snippet that ships with Code Snippets? Something like:
 *     ```
       add_filter( 'mce_buttons', function ( $buttons ) {
       	$buttons = array_diff($buttons, ["code_snippets"]);
       	return $buttons;
       });
       ```
   
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/disable-the-tinymce-code-snippets-button-dropdown/#post-16279914)
 * Hi [@codejp3](https://wordpress.org/support/users/codejp3/),
 * You can remove it with the `mce_buttons` filter:
 *     ```
       add_filter( 'mce_buttons', function ( $buttons ) {
           return is_admin() ? 
               $buttons :
               array_diff( $buttons, array( 'code_snippets' ) );
       }, 15 );
       ```
   
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/disable-the-tinymce-code-snippets-button-dropdown/#post-16279917)
 * Ah, my apologies, I didn’t see your follow-up post earlier.
 * I have added it as a snippet on our cloud platform, which will soon be replacing
   the sample snippets included with the plugin: [https://codesnippets.cloud/snippet/shea/remove-snippets-tinymce-button](https://codesnippets.cloud/snippet/shea/remove-snippets-tinymce-button)
 *  Thread Starter [codejp3](https://wordpress.org/support/users/codejp3/)
 * (@codejp3)
 * [3 years, 5 months ago](https://wordpress.org/support/topic/disable-the-tinymce-code-snippets-button-dropdown/#post-16284880)
 * Thanks for the reply and link to the codesnippets cloud!
 * Between our posts, there’s 3 variations of disabling the TinyMCE buttons:
    1. Only in bbPress
    2. Site-wide
    3. Only in admin panel
 * I could think of plenty more conditions to enable/disable it as well. No way 
   to cover every scenario and justifies NEVER making it a built-in dedicated plugin
   setting and keeping it an optional code snippet.
 * Thanks again!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Disable the TinyMCE Code Snippets Button/Dropdown’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

## Tags

 * [tinymce](https://wordpress.org/support/topic-tag/tinymce/)

 * 4 replies
 * 2 participants
 * Last reply from: [codejp3](https://wordpress.org/support/users/codejp3/)
 * Last activity: [3 years, 5 months ago](https://wordpress.org/support/topic/disable-the-tinymce-code-snippets-button-dropdown/#post-16284880)
 * Status: resolved