After a lot of searching I’ve put this together. It appears to remove the ability of normal site users to use the rich text area editor in ‘multi line text areas’. Its use now allows jQuery functions for character limits to be applied to the text area which was not possible when tinymce was active.
function bptest_remove_tinymce() {
if ( !is_super_admin() ) {
tinymce.activeEditor.getBody().setAttribute( 'contenteditable', false );
}
}
add_action( 'wp_footer', 'bptest_remove_tinymce' );
Note that the is_super_admin()
is included. Without it the WP bar at the top of the screen which is used to access dashboard etc disappears.
Then to remove the remaining Visual/Text tabs attached to the text area, use the CSS display:none
on the relevant div id.
I am still very curious as to whether there are better methods for excluding the rich text editor / tinymce from Buddypress (across the site and/or targeting specific text areas). Would appreciate any input from anyone more in the know!
Thanks
Hi,
best solution is to use the built-in filter, instead of modifying tinymce which may affect all editors.
The filter is bp_xprofile_is_richtext_enabled_for_field
I provided a working example here:
https://buddypress.org/support/topic/suppressing-rich-text-on-xprofile-text-area/#post-247640