WP_Editor – Setting render location on page

I’m trying to include wp_editor in a settings page.

public function addEditor($content = '')
{       
    $editor_id = 'createposteditor';

    $args = array(
        'textarea_rows' => 15,
        'teeny' => true,
        'quicktags' => false,
        'editor_class' => 'createpost-editor'
    );

    return wp_editor( $content, $editor_id, $args  );
}   

and then I echo it out on the settings page:

Read More
<tr>                    
    <td align="left" scope="row">                                                                 

        <h1>Add content (optional)</h1>
        '. $poster->addEditor() .'                                           
    </td>
</tr>

My issue is, the editor always gets rendered at the top of the page, not from within the <td> as I require.

Related posts

1 comment

  1. As kaiser has stated, you are attempting to return the the markup for an instance of the WP Editor, but you’re using wp_editor() – a function that echos its output.

    From the
    source it
    is absolutely clearly stated that this method renders the editor. You
    need to call it exactly where you want it.

Comments are closed.