tinymce editor getContent null in WordPress

I am trying to use the getContent feature of the Tinymce editor in WordPress admin area but to no avail.

Here is a working pen of what I want to do



<textarea class="wp-editor-area" rows="20" autocomplete="off" cols="40" name="wprss_ftp_post_prepend" id="wprsspostprepend">&lt;p&gt;To give is good&lt;/p&gt;</textarea>


jQuery(document).ready(function() {
var name = "wprsspostprepend";
if($("#" + name).length > 0) {

        mode : "specific_textareas",
        editor_selector : "prepend_editor"  
   var content =  tinyMCE.activeEditor.getContent();
    tinyMCE.activeEditor.setContent("<div id='random-wrap'>" + content + "</div>");

Why am I getting the null reference error in WordPress if it works in codepen.

Read more here: tinymce editor getContent null in WordPress

Leave a Reply

Your email address will not be published. Required fields are marked *