Enable Visual Editor
In bbPress 2.3.1, WordPress’s visual editor was defaulted to off. To turn it back on, try this code snippet in a plugin or your theme’s functions.php file:
function bbp_enable_visual_editor( $args = array() ) { $args['tinymce'] = true; return $args; } add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );
You can also customize the visual editor by adding more arguments into the function.
Use this function below to only show the visual editor and not the html editor at all.
function bbp_enable_visual_editor( $args = array() ) { $args['tinymce'] = true; $args['quicktags'] = false; return $args; } add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );
You can also show other media buttons like an emoticon button to insert smilies if you are using a plugin like TinyMCE Advanced.
Use this function below instead with new argument added to be able to add new media like the emoticon button.
function bbp_enable_visual_editor( $args = array() ) { $args['tinymce'] = true; $args['teeny'] = false; return $args; } add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );
Please note that if you disable the teeny mode in the visual editor and allow other media buttons through the TinyMCE Advanced plugin, you will probably need to add on to this function and put it into your child theme functions.php file to allow your users to use some of the buttons like the table button.
In some cases, text pasted into the visual editor will bring along unwanted styles and HTML markup. You can use another function to force pasted text to be cleaned up. This will remove things like stray HTML but leave in basics like bold and italics.
function bbp_tinymce_paste_plain_text( $plugins = array() ) { $plugins[] = 'paste'; return $plugins; } add_filter( 'bbp_get_tiny_mce_plugins', 'bbp_tinymce_paste_plain_text' );