1

I want to initialize the wordpress editor dynamically on frontend. I have tried to include the following scripts:

wp_enqueue_script('editor');
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');

Then to init the editor like this:

tinymce.init({
  mode : 'specific_textareas',
  editor_selector :'tinymce'
});

But it does not work. Any ideas?

0

You are in luck. There is a Wordpress internal function for that. It's the wp_editor function.

The function does all the work for you. It enqueues the right scripts and style-sheets. Just pass the configuration you want.

wp_editor('Enter your text here', 'editor_id_here') 
  • 1
    I think she asked if there is a way to add editors dynamically from javascript from from PHP. – Andrei Canta Nov 5 '15 at 19:25

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.