reading the quicktags.dev.js i see in the comments

 * Run quicktags(settings) to initialize it, where settings is an object containing up to 3 properties:
 * settings = {
 *   id : 'my_id',          the HTML ID of the textarea, required
 *   buttons: ''            Comma separated list of the names of the default buttons to show. Optional.
 *                          Current list of default button names: 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,spell,close';
 * }
 * The settings can also be a string quicktags_id.
 * quicktags_id string The ID of the textarea that will be the editor canvas
 * buttons string Comma separated list of the default buttons names that will be shown in that instance.

which seems like i should be able to call the javascript functions quicktags(), pass it at least the ID of a text area and I should get the quicktags editor created just before any textarea. (i'm working in a metabox).

however, if i put the following in my code:

try { quicktags( '_repeating_textareas_meta[repeating_textareas][0][textarea]'); } catch(e){}

which I essentially copied from bit of javascript that WP has it in the source and added my metabox's ID.

it prints out the div where the quicktags toolbar should be but doesn't make any buttons

<div id="qt__repeating_textareas_meta[repeating_textareas][0][textarea]_toolbar" class="quicktags-toolbar"></div> 

console.log doesn't show any errors. and i swear that this time i have undone all potential tampering to source code.


i've isolated the problem down to where the script appears in the source... using Fred Rocha's function works great (and much like i anticipated) if it runs on the admin_print_footer_scripts but not on after_wp_tiny_mce... it results in the same empty toolbar i was getting.

other parts of my jquery plugin need to run after the tinymce settings are initialized (since i'm straight borrowing the existing settings), so why would it work properly on the one hook but not on a later hook?

  • console.log doesn't show any errors – of course, your catch statement prevents that. :)
    – fuxia
    Commented Mar 9, 2012 at 5:50
  • even trying to console.log(e) inside the catch statement i don't get an error, b/c the catch statement isn't run.... since an empty toolbar is being generated. Commented Mar 9, 2012 at 13:46
  • What happens if you fill the buttons parameter?
    – fuxia
    Commented Mar 9, 2012 at 21:51
  • 1
    nothing. i've tried that too. Commented Mar 9, 2012 at 23:36
  • @toscho any idea why Fred Rocha's answer would work on the admin_print_footer_scripts hook but not on the after_wp_tiny_mce hook? Commented Mar 27, 2012 at 18:25

2 Answers 2


I have stumbled into this very same issue, and got the quicktags to work.

Here's the code to add to functions.php:

function my_admin_print_footer_scripts()
<script type="text/javascript">/* <![CDATA[ */

    var id = "myID"; // this is your metabox's textarea id

    settings = {
        id : id,
        buttons: 'strong,em,link' 


/* ]]> */</script>
<?php } ?>

This is the basic code that should get quicktags to work.

In case you want to go through all the (Verve) Metaboxes, and assign a toolbar, the following code could do the trick:

function my_admin_print_footer_scripts()
    ?><script type="text/javascript">/* <![CDATA[ */
        var i = 1;
        $('.verve_meta_box_content textarea').each(function(e)
        var id = $(this).attr('id');
            if (!id)
        id = 'customEditor-' + i++;

            settings = {
                id : id,
                buttons: 'strong,em,link' // Comma separated list of the names of the default buttons to show. Optional.


/* ]]> */</script>
<?php } ?>

Also, in order to keep the line breaks on your front end, make sure you use "the_content" filter when outputting the textarea content, as so:

// schedule is the slug of the custom meta field
$schedule_juice = get_post_meta($current_post_ID, "schedule", false);
// preserve line breaks     
$content = apply_filters('the_content', $schedule_juice[0]);
echo $content; 

The priority with which the my_admin_print_footer_scripts method was being called was the blocking issue.

Good luck!

  • care to share any of that jquery 'magic'? b/c i'm trying to add it any repeating textareas in a metabox. so i am dynamically generating the ID for the textarea. works fine w/ tinyMCE (go fig) but i still get the empty toolbar here. the script is running about dead last, so quicktags have been loaded. this does work if i have a statically named ID. Commented Mar 26, 2012 at 23:56
  • Updated answer!
    – Fred Rocha
    Commented Mar 27, 2012 at 11:01
  • i disabled all of my own scripts and added your code and finally some success!! now i need to figure out what i have written that is conflicting. thanks! also- instead of using the_content filter i usually create a meta_content filter. then i add the functions that are typically added to the_content to meta_content... sort of a duplicate. i did this b/c plugins add things to the_content and so i got share buttons all over the screen one time! Commented Mar 27, 2012 at 17:13
  • You're welcome! Great to know i could be of assistance. Your custom based filter sounds good, WP is a wonderful, tailorable machine!
    – Fred Rocha
    Commented Mar 27, 2012 at 17:44
  • following the answer, I run into empty toolbar. If you're experiencing the same, check out my answer to a related topic: wordpress.stackexchange.com/a/151923/14022 Commented Jun 26, 2014 at 18:27

I have been able to display Alex King's quicktag script in my comment form.

I have documented the steps and code here.

add_filter( 'comment_form_defaults', 'pc_comment_form_args' );

function pc_comment_form_args( $args ) { 
$args['comment_field'] = '<p class="comment-form-comment">' .
                         '<label for="comment">Comment</label>' .
                         '<script type="text/javascript">edToolbar("comment");</script>' .
                         '<textarea id="comment" name="comment" cols="45" rows="8" aria-required="true">' .
                         '</textarea>' .
 return $args;

Just Download and enqueue the Alex Kings QuickTag Script. :-)

  • Then please inlcude (parts of) the document here. Else this answer does not provide any help.
    – tfrommen
    Commented Nov 8, 2013 at 7:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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