Title: Add custom button to TinyMCE?
Last modified: August 18, 2016

---

# Add custom button to TinyMCE?

 *  [3stripe](https://wordpress.org/support/users/3stripe/)
 * (@3stripe)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/add-custom-button-to-tinymce/)
 * Hi folks,
 * I want to add a simple button to the WYSIWYG editor that wraps the selected text
   in a particular style (ie applies a span tag to it, with a class of say ‘mp3link’)
 * I’m found a TinyMCE plugin called “tinyMCE div and have downloaded it from [http://tincan.co.uk/?lid=1624](http://tincan.co.uk/?lid=1624)
   and put into the TinyMCE plugins folder.
 * Now I’m trying to initiate this using my own plugin – but don’t understand the
   syntax for the `tinymce_plugins` action.
 * I know that I’m way off, but I’m using the code below for my plugin, how should
   I be doing it?
 * ‘add_action(‘tinymce_plugins’, ‘add_divselect_to_tinyMCE’);
    function add_divselect_to_tinyMCE(){
   plugins = new Array(“divselect”); return plugins; }’
 * Thanks for your time.

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

 *  Thread Starter [3stripe](https://wordpress.org/support/users/3stripe/)
 * (@3stripe)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/add-custom-button-to-tinymce/#post-396138)
 * According to the wiki:
 * `After you have inserted your javascript functions, you will need to modify the
   TinyMCE plugin list. This is done with the filter hook 'tinymce_plugins'. Your
   filter should take an array as its only argument, add your plugin's name to it
   and return it.`
 * But what does this mean exactly? I’m confused…
 *  Thread Starter [3stripe](https://wordpress.org/support/users/3stripe/)
 * (@3stripe)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/add-custom-button-to-tinymce/#post-396139)
 * According to the wiki:
 * `After you have inserted your javascript functions, you will need to modify the
   TinyMCE plugin list. This is done with the filter hook 'tinymce_plugins'. Your
   filter should take an array as its only argument, add your plugin's name to it
   and return it.`
 * But what does this mean exactly? I’m confused…
 *  [maerk](https://wordpress.org/support/users/maerk/)
 * (@maerk)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/add-custom-button-to-tinymce/#post-396142)
 * Are you a particularly big fan of TinyMCE? It’s just that I could really easily
   tell you how to do this with Quicktags, which works better 🙂
 * There’s another thing, Buttonsnap, which might do what you want:
 * [http://redalt.com/wiki/ButtonSnap](http://redalt.com/wiki/ButtonSnap)
 * I never worked out how to use that, though.
 *  Thread Starter [3stripe](https://wordpress.org/support/users/3stripe/)
 * (@3stripe)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/add-custom-button-to-tinymce/#post-396150)
 * Hi thanks for the reply.
 * I don’t like it much, but I’v got users on my site who do, so I wanted this function
   to work!
 * I’ve tried Buttonsnap as well, but have the same problem as you do – can’t figure
   out how to use it! (My javascript isn’t up to scratch)
 * Didn’t think this would be so hard!
 *  [maerk](https://wordpress.org/support/users/maerk/)
 * (@maerk)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/add-custom-button-to-tinymce/#post-396152)
 * Have a look at the actual javascript that TinyMCE uses. See if there’s a way 
   to customise it with buttons.
 * If you look at the quicktags.js file (`wp-includes/js`) you can see it’s actually
   quite easy to insert new buttons. Maybe tinyMCE is the same???
 * It’s a real shame that it’s so hard to use this! It’s very pretty, from what 
   i recall (I disabled it almost instantly, too many bugs).
 *  Thread Starter [3stripe](https://wordpress.org/support/users/3stripe/)
 * (@3stripe)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/add-custom-button-to-tinymce/#post-396157)
 * Maybe I should just wean the other users off it.
 * But I’ve spent so much time on this I’m kinda tempted to figure this out!
 *  [maerk](https://wordpress.org/support/users/maerk/)
 * (@maerk)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/add-custom-button-to-tinymce/#post-396158)
 * It’s definately possible. Keep trying and you’ll get there.
 * I’d wager that TinyMCE is an external thing that someone developped that was 
   then got incorporated into WP. Try to find its site and maybe you can ask the
   developer — but try to find his/her preferred method of being asked for support.
   Nothing worse than being pestered by emails 🙂
 *  Thread Starter [3stripe](https://wordpress.org/support/users/3stripe/)
 * (@3stripe)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/add-custom-button-to-tinymce/#post-396165)
 * I’ve tried the TinyMCE forum, and the author of the plugin, no replies yet…
 * Who knows, maybe we can build a nice plugin for WordPress to automate the process!
 *  [maerk](https://wordpress.org/support/users/maerk/)
 * (@maerk)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/add-custom-button-to-tinymce/#post-396176)
 * The guy that runs redalt is quite friendly, I think. I only ever emailed him 
   once, but he seems nice 😉
 * I have to say, I only tried to use TinyMCE once, but my javascript knowledge 
   is minimal and I didn’t really need it for what I was doing. But it looked like
   the sort of thing that once I’d worked out how to do it, it would leave me with
   a lot more javascript expertise, so it’s worth going for, definately.
 * You’ll be writing your own wordpress plugins in no time!

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

The topic ‘Add custom button to TinyMCE?’ is closed to new replies.

## Tags

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

 * 9 replies
 * 2 participants
 * Last reply from: [maerk](https://wordpress.org/support/users/maerk/)
 * Last activity: [19 years, 11 months ago](https://wordpress.org/support/topic/add-custom-button-to-tinymce/#post-396176)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
