I'm trying to create a front-end editor for my Wordpress theme using wp_editor.

While it outputs the editor, there's loads missing from it. There's no title, no submit button and none of the JS works, so you can't switch between tabs, upload media and the formatting buttons don't appear.

I know I'm missing something obvious and that it's probably a JS file I need to include, but I can't find a solution about it anywhere online and the codex page on the function doesn't mention JS at all.

What am I doing wrong? Have I fundamentally misunderstood this function?

Here's my (very simple) code:

        $settings = array( 'textarea_name' => 'post_text', 'tinymce'=>true ); 
        wp_editor($content, $editor_id, $settings ); 
  • wp_editor() function loads the editor in the specified textarea, inlucindg TinyMCE and editor buttons (like Media button), that's all. You expect it to load a full form, maybe similar to wp-admin edit screen, but it is not what the function does. You need to build your own form and handle the form submission yourself. About the problems with JS, can you show us a sample code of your implementation? – cybmeta Feb 12 '15 at 9:53
  • did you declare $content and $editor_id? – ungestaltbar Feb 12 '15 at 10:24
  • @ungestaltbar - the editor_id is declared through 'textarea_name'. Didn't declare content, but it doesn't make a difference if I do. – SinisterBeard Feb 12 '15 at 10:35
  • the editor_id is independent from textarea_name. try wp_editor('', 'exampleid', $settings) and report the result :) – ungestaltbar Feb 12 '15 at 10:37
  • @ungestaltbar No difference, I'm afraid. – SinisterBeard Feb 12 '15 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.