• I have a custom metabox which uses wp_editor and when i switch to text editor instead of visual the main content tinymce also changes to text view when i update. I was wondering am i doing something wrong or is that normal behavoir for wordpress when creating a custom metabox and wp_editor?

    the code i use to set all of this up is:

    `add_action(‘add_meta_boxes’, ‘page_tagline_meta_box’);
    function page_tagline_meta_box($post) {
    global $post;
    $post_id = $_GET[‘post’] ? $_GET[‘post’] : $_POST[‘post_ID’] ;
    $homepage_id = get_option(‘page_on_front’);

    $screens = array( ‘services’, ‘page’);
    if($homepage_id != $post_id) {
    foreach ($screens as $screen) {
    add_meta_box(‘page_tagline_id’, ‘Tagline text & Telephone number’, ‘page_tagline_meta_box_cb’, $screen, ‘normal’, ‘high’);
    add_meta_box(‘additional_content_id’, ‘Additional Content’, ‘additional_content_meta_box_cb’, $screen, ‘normal’, ‘high’);
    }
    }
    }
    function additional_content_meta_box_cb($post) {
    global $post;
    wp_nonce_field(‘additional_content_box_nonce’, ‘additional_content_meta_box_nonce’);

    $values = get_post_custom($post->ID);

    $additionalContent = isset($values[‘additionalContent’]) ? $values[‘additionalContent’][0]: ”;

    $settings = array(
    ‘textarea_rows’ => 15,
    ‘wpautop’ => true
    );

    wp_editor($additionalContent, ‘additionalcontent’, $settings);
    }`

    If you would like to see the save function you are welcome to but i know it all saves and i can get the content out in my templates. its just when i switch views on the custom metabox it also switches the view of the main text area for the page when i hit update which i find quite odd.

    Thanks in advance for your help

    Alex

  • The topic ‘all tincymce's switch when updating page after changing from html to text in cus’ is closed to new replies.