Search code examples
phpwordpressbuddypress

Error in buddypress when using wp_editor


Since none of plugin works with new wordpress and buddypress for rich text editor I have started to implement it myself manually directly into the theme.

After using wp_editor() I got the editor on my fourms and it is posting forums content well without issue. However when I am trying to edit forums post it is not loading any content into the text editor. I am using below code if anyone can help me.

$content = bp_the_topic_text();
    $args = array(
    'quicktags' => true,
   'editor_class' => 'frontend',
   'textarea_rows' => 5,
   'tabindex' => 1
    );
wp_editor( $content, 'topic_text', $args);

This doesnt load the forum post content just wonder. I have tested with the sting and just works fine it loads the string but not the actual content with the function. I dont know either this is the right function to get the content or not.

I am getting output like enter image description here

I want show content in inside of editor.

Thanks a lot in advance.


Solution

  • bp_the_topic_text() echoes the value. It's a wrapper for bp_get_the_topic_text(), which returns the value. So you should do this instead:

    $content = bp_get_the_topic_text();