1

I have a custom post type which has multiple wysiwyg editors within the same post. When creating a new post of this type, I wish to have default text in some of these wysiwyg editors but not in the main wysiwyg editor. Using the "default_content" filter hook, I was able to add text to the main editor, but was unable to reach the other wysiwyg editors.

How would I go about adding text to the non-main wysiwyg editors? Is there a hook to reach all wysiwyg editors and then I'd need to filter which ones are not the main wysiwyg editor?

  • Well how do you register your others WYSIWYG editors? normally you would set the default text for those editors in the callback function that creates those editors. They are not defaults editors so you won't get WP filters to edit those. If you could update your question with more info and example of the code you used, it would be easier for someone to help you out. – bynicolas Aug 10 '16 at 3:26
  • @bynicolas Thanks for the reply. One of the issues is that I don't know how the wp_editor was created. I'm parachuting into another person's code and it seems that he never calls wp_editor to create them. Can the WYSIWYG editor's creation information be stored in the database instead? – Paul Sim Aug 16 '16 at 20:27
1

Not sure exactly how you are adding the editor but with wp_editor() the first parameter is the default content.

Codex reference: https://codex.wordpress.org/Function_Reference/wp_editor

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.