6

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);

2
  • You may want to remove the esc_html function, otherwise the visual editor will dislay the actual html code. Jan 2, 2012 at 0:33
  • 1
    You might consider adding your answer and marking your question as answered, so it doesn't sit in the dark hall of unanswered questions for eternity. As a bonus, you give yourself 15 points :) Jan 30, 2012 at 4:37

1 Answer 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 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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