WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I write a programming blog, so sometimes I just have to write a word to represent a command or function which I like writing between the code tags. (See, what I just did there).

So, just like StackExchange has the "code" button, is there a plugin to add this button to the visual editor? I know I got it on the HTML editor, but I rarely use it.

I was thinking of writing a plugin for this, but just in case I'm asking first in case anyone knows of a plugin doing this already.

share|improve this question
up vote 3 down vote accepted

There seem to be a few people scratching this itch over at the TinyMCE sourceforge tracker. http://sourceforge.net/tracker/?group_id=103281&atid=738747

This looks promising.. "CodeExtras adds <var> and <code> markup buttons - ID: 2904557" http://sourceforge.net/tracker/?func=detail&aid=2904557&group_id=103281&atid=738747

share|improve this answer
You could also add the code tag to the blockformats dropdown like in the example here. tinymce.moxiecode.com/wiki.php/… – MirlitonMedia Jan 25 '11 at 1:31
It is such a small edit, that it could be overkill to search for a plugin to do this. Just add the <code> tag to the blockformats dropdown and be done with it. – Jan Fabry Jan 26 '11 at 10:04

I haven't tested this code, but I think it should work:

function rw_mce_buttons($mce_buttons) {
    $mce_buttons[] = 'code';

    return $mce_buttons;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.