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

Is there a way to get my custom TinyMCE button to insert multiple lines of text? Ultimately I am making a "Premade Themes" button where a user will select a theme and it will insert about 6-8 different shortcodes with one click and they can edit the shortcodes accordingly..

A problem I'm having is that all of these shortcodes get put in one line. Here's the code I use that actually pastes the shortcodes:

tinyMCEPopup.editor.execCommand('mceInsertClipboardContent', false, {content : 'the shortcodes go here'});

Any help is appreciated!

share|improve this question
up vote 2 down vote accepted

This should be as easy as adding <br /> between shortcodes or every time you want to add a new line and also if you are inserting content you should use mceInsertContent instead of mceInsertClipboardContent unless you are actually getting the content from the clipbard, so:

tinyMCEPopup.editor.execCommand('mceInsertContent', false, '<p>[shotcode1]<br/>[shotcode2]<br/>[shotcode3]</p>'));
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.