I am working on a BuddyPress plug-in for a client that requires users to be able to add content from the front end – they never see the back end for security reasons. I have the plug-in written and it works perfectly but it is missing one thing: a rich text editor so that users can customize their content (within reason, of course). Until now, I have ignored this request from the client and explained it as not being possible without a lot more work.

Today, however, I upgraded to 3.3 and noticed the new wp_editor tag.
I tried some of the examples shown here, but I cannot get any of them to work properly (a bare-bones call produces the editor but the tabs and media buttons don’t work, a basic TinyMCE setting array yields nothing [just a plain textarea].) Inspection with Chrome’s Developer Tools reveals that some JavaScript files are being included in the admin area that are not included on the front end. What is the best way to include these files and make this thing work? Thanks!

4 Answers
4

note that wp_editor will echo to output, not put it in a variable.
If you want to put it in a variable, just do

ob_start();
wp_editor($content, 'textarea_rich', $args);
$html = ob_get_contents();
ob_end_clean();

and you have what you need in $html.
You can also see https://plugins.svn.wordpress.org/indypress/tags/1.0/indypress/form_inputs/tinymce.php for a working implementation.

Another issue I noted is some problem is with w3-total cache minifying (actually, I had those issue with wp_tiny_mce, the function used in wp <= 3.2; I have not checked if it is buggy in wp_editor, too)

Leave a Reply

Your email address will not be published. Required fields are marked *