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:
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:
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:
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:
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?
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: