TinyMCE editor displaying incorrectly

I have created a custom post type in the functions.php file of my theme. I want to add an additional tinyMCE editor as a meta box. I’ve read that you can use wp_editor(); to add the tinyMCE editor to a post type. However, I’m not fully sure how to execute this piece of code. Here is what I have so far:

This creates the post type:

function wpt_slider_posttype() {
register_post_type( 'slider',
    array(
        'menu_icon' => '',
        'labels' => array(
            'name' => __( 'Homepage Slides' ),
            'singular_name' => __( 'Homepage Slide' ),
            'add_new' => __( 'Add New Slide' ),
            'add_new_item' => __( 'Add New Slide' ),
            'edit_item' => __( 'Edit Slide' ),
            'new_item' => __( 'Add New Slide' ),
            'view_item' => __( 'View Slide' ),
            'search_items' => __( 'Search Slides' ),
            'not_found' => __( 'No slides found' ),
            'not_found_in_trash' => __( 'No slides found in trash' )
        ),
        'public' => true,
        'supports' => array( 'title', 'thumbnail' ),
        'capability_type' => 'post',
        'rewrite' => array("slug" => "slider"), // Permalinks format
        'menu_position' => 5,
        'register_meta_box_cb' => 'add_slider_metaboxes'
    )
);
}
add_action( 'init', 'wpt_slider_posttype' );

And this is where I add the metaboxes:

function add_slider_metaboxes() {
add_meta_box('slider_link_text', 'Link Text', 'slider_link_text', 'slider', 'normal', 'default');
wp_editor( '', 'mycustomeditor' ); 
}

Currently though, this adds a massive editor to the very top of my page

Does anyone know how I can place this in the right place on my page (i.e. with all the other metaboxes)?

Read more here: Add TinyMCE editor as meta box to custom post type using wp_editor


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , , , , , ,

Wordpress related questions and answers: