I don’t know of an alternative to wp_editor that returns the output. There probably isn’t one because the editor is a lot of different stuff, JS files get loaded to support it, it’s probably a mixture of templates and JS to render as well. Anyway the solution I’d use is PHP output buffering with ob_start(), ob_get_contents(), ob_end_clean(). What this does is allow you to store the output rather than have it print/echo out immediately. It’s a valuable tool to know as well because it’s used all the time in template output, when template files are loaded often the file is required/included but the code is stored with output buffering and printed later.
ob_start();
wp_editor( $settings );
$editor = ob_get_contents();
ob_end_clean();
At this point you have all the code stored in the variable $editor, print it when/where you need it. I haven’t actually tried this with wp_editor() but in principle it should work unless there is some complication involving the javascript.
For reference and more details see answer at https://stackoverflow.com/questions/4401949/whats-the-use-of-ob-start-in-php
-
This reply was modified 7 years, 6 months ago by goldhat.
-
This reply was modified 7 years, 6 months ago by goldhat.
-
This reply was modified 7 years, 6 months ago by goldhat.