Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am adding fields to a custom post type. How can I have editing options in my meta data just as they are in the editor box?

 add_action('add_meta_boxes', 'add_property');

 function add_property(){
 add_meta_box("description-meta", "Property Description", "desc_options", "property", "normal");
 }

    function desc_options(){
    global $post;
    $values = get_post_custom($post->ID);
    $description = isset( $values['description'] ) ? esc_attr( $values['description'][0] ) : '';

    wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );
?>
    <p>
    <label>Description:</label><br/><textarea name="description" cols="100" rows="20"><?php echo $description; ?></textarea>
    </p>

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Unfortunately you can't yet...

see this trac ticket: http://core.trac.wordpress.org/ticket/19173

In particular it seems that:

The problem is that TinyMCE, once initialized cannot be moved in the DOM, or rather the browsers cannot handle it being moved. That's why the errors are so inconsistent in different browsers. Moving the postbox triggers this. Some browsers/versions handle that better than others as @ocean90 mentions above but generally the editor textarea and iframe shouldn't be moved. -azaozz

share|improve this answer

Post custom metabox textarea using wp_editor

There is at least 1 issue with using wp_editor in a meta box, as discussed in ticket #19173(Good read on the subject of wp_editor and meta boxes). TinyMCE gets all messed up if you move the meta box that contains it (specifically, if TinyMCE's location in the DOM is changed). You can, however, use the Quicktags version (non tinyMCE). Another alternative is to just not move the box (lame) or add your editors using the edit_page_form or edit_form_advanced hooks instead of using add_meta_box().

I wrote a quick plugin to demonstrate the issue. It's a fully working example of using wp_editor in a meta box though. You can configure wp_editor to make it more meta box friendly by disabling TinyMCE and enabling quicktags using the appropriate args.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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