I'm trying to write a Wordpress plugin. I will get counts words which in WP's Tinymce editor. Basically, it's a word counter which counting long of your post and giving you this message in a meta box
Your post has 450 words
My just problem is getting words from Tinymce via javascript. This isn't working :
document.getElementById('content')
Tinymce's content's id is content . But this code returning NULL. I couldn't find valid id name for Tinymce.
In shortly, other all codes are ready, just i can't get words from Wordpress' WYSIWYG editor.
Thanks.
that tinymce.getContent() likes to add. Instead try using `wp.editor.getContent('content')`. There's not much documentation on it, but I've found it returns exactly what will get stored in the database.
– milesvp Dec 13 '18 at 20:38