How to edit posts with the new wp_editor api?

I am using bbPress 2x and modified the plugin to use the new wp_editor in place of the textarea for adding new topics and replies. This part works beautifully.

Where I am stuck is when a person clicks edit for a topic or a reply. The post content is not showing up in the editor.

I’m probably just missing something really stupid, and hoping someone can chime in on how to fix this last piece.

Here is what I am using:

$tabindex = bbp_get_tab_index();
$settings = array(
    'wpautop' => true,
    'media_buttons' => true,
    'editor_class' => 'tumble',
    'tabindex' => $tabindex
);

wp_editor( ”, ‘bbp_topic_content’, $settings );

thanks

EDIT

Just got an answer to my question, and it works great

Thanks go out to:
http://soderlind.no/archives/2011/09/25/front-end-editor-in-wordpress-3-3/#comment-207831

$post = get_post($post_id, 'OBJECT');
wp_editor(esc_html($post->post_content), 'textarea01', $settings);

1
1

For the sake of completeness, I am going to post an answer based on the solution you edited in your question.

$post = get_post( $post_id, 'OBJECT' );
wp_editor( esc_html( $post->post_content ), 'textarea01', $settings );

This would escape the HTML too so if you are editing a post you might want to replace the last line with:

wp_editor( $post->post_content, 'textarea01', $settings );

Leave a Comment