The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WordPress: Add a 2nd TinyMCE Meta Box

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #33466

    I cannot, for the life of me, figure this one out. Every tutorial on the planet is the most convoluted and complicated thing I’ve ever read.

    What I am trying to do sounds simple in principle, but is proving to be a time-vortex.

    Goal: Have a second editable text area while editing a page in WordPress that utilizes TinyMCE.

    Adding a simple textarea is easy, it’s adding the TinyMCE part that seems to have me stumped.

    There are some plugins out there, but they are either too bloated or have stopped functioning properly. I feel like this is something that people must be utilizing all of the time while developing for WordPress – the only reason I haven’t done it before is poor documentation!

    I got really close with this link:

    But the details that would help me implement it are missing. Any help would be greatly appreciated!


    I absolutely poured hours into this and finally, after much frustration, have a working system. This is what goes in functions.php:

    $prefix = 'dbt_';

    $meta_box = array(
    'id' => 'my-meta-box',
    'title' => 'Related Links',
    'page' => 'page',
    'context' => 'normal',
    'priority' => 'high',
    'fields' => array (
    'name' => 'Textarea',
    'desc' => 'Enter big text here',
    'id' => $prefix . 'textarea',
    'type' => 'textarea',
    'std' => 'Default value 2'

    add_action('admin_menu', 'mytheme_add_box');

    // Add meta box
    function mytheme_add_box() {
    global $meta_box;

    add_meta_box($meta_box, $meta_box, 'mytheme_show_box', $meta_box, $meta_box, $meta_box);

    // Callback function to show fields in meta box
    function mytheme_show_box() {
    global $meta_box, $post;

    // Use nonce for verification
    echo '';

    foreach ($meta_box as $field) {
    // get current post meta data

    $meta = get_post_meta($post->ID, $field, true);

    echo '', '
    ', $field;


    add_action('save_post', 'mytheme_save_data');

    // Save data from meta box
    function mytheme_save_data($post_id) {
    global $meta_box;

    // verify nonce
    if (!wp_verify_nonce($_POST, basename(__FILE__))) {
    return $post_id;

    // check autosave
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
    return $post_id;

    // check permissions
    if ('page' == $_POST) {
    if (!current_user_can('edit_page', $post_id)) {
    return $post_id;
    } elseif (!current_user_can('edit_post', $post_id)) {
    return $post_id;

    foreach ($meta_box as $field) {
    $old = get_post_meta($post_id, $field, true);
    $new = $_POST[$field];

    if ($new && $new != $old) {
    update_post_meta($post_id, $field, $new);
    } elseif ('' == $new && $old) {
    delete_post_meta($post_id, $field, $old);


    And this is what I use to call it on the page:

    $meta = get_post_meta(get_the_ID(), 'dbt_textarea', true);
    echo $meta; // if you want to show

    And here is the updated version of what I’m using:


    Good to know thanks!


    in wordpress 3.3 version wp_editor function is added to save us from these headaches. for your information
    Here is the link

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Back End’ is closed to new topics and replies.