TinyMCE in Custom Metabox not loaded after upgrading from WP 3.1.4 to WP 3.2

I want something very simple: a custom metabox with a TinyMCE editor in it.

The following code help me achieve that easily in 3.1.4:

Read More
add_action( 'add_meta_boxes', 'add_metaname_box');
function add_metaname_box() {
    add_meta_box(
        'metaname_id',
        __( 'metaname text', 'metaname_textdomain'),
        'metaname_custom_box',
        'post'
    );
}

function metaname_custom_box() {
    global $post;
    wp_nonce_field( plugin_basename( __FILE__ ), 'metaname_noncename' );
    $data = get_post_meta($post->ID, 'metaname_custom_box', true);
    echo <<<EOT
    <textarea id="metaname_custom_box" name="metaname_custom_box" class="theEditor">$data</textarea>
EOT;
}

This is what it looked like:
Visual editor in custom meta box

My problem is that this code is no longer works after I upgraded from 3.1.4 to 3.2.
This is the result for the same code after upgrading to 3.2:
Regular textfield in custom meta box

The HTML code for TinyMCE is not generated anymore.

However, I noticed that this piece of code still works fine in a fresh installation of WP 3.2. This is the result of the code in fresh installation:
Visual editor in 3.2 style in custom meta box

Can someone help me why my code works fine with 3.1.4 and fresh 3.2, but not in the 3.2 upgraded from 3.1.4 ? How to solve this problem?

Related posts

Leave a Reply

1 comment

  1. Found the solution. I’ll put it here in case anyone stumbles on the same problem. According to here, this code helped me solve my problem:

    add_action("admin_head","myplugin_load_tiny_mce");
    
    function myplugin_load_tiny_mce() {
    
    wp_tiny_mce( false ); // true gives you a stripped down version of the editor
    
    }