I have a custom admin page setup in wordpress and I'm using the wp_editor() function to show a text editor box, but when I submit/POST the form, the text enter into the editor field is blank.
See (abridged) code for example:
<form method="POST" action="<?php echo admin_url('admin.php?page=mypage');?>">
<?php wp_editor('','newtestfield',array('textarea_name'=> 'newtestfield'));?>
<input type="submit" value="GO">
</form>
<?php
if(!empty($_POST)){
print_r($_POST); // At which point "newtestfield" is always empty (does not reflect any text entered into the editor field)
}
?>
Turns out I had some javascript on the page, which I had thought was required to get the editor running, actually it was causing my editor not to work properly, here's the jquery code that I had to remove:
$("#team_history").addClass("mceEditor");
if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) {
tinyMCE.execCommand("mceAddControl", false, "team_history");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With