Tutorial :Wordpress and Widget using TinyMCE



Question:

I have written a Text/HTML widget that uses TinyMCE to allow some basic formatting. However, when I save the changes, the data in the textarea is not getting posted. If I use just a simple textarea without TinyMCE then I can save the data properly. Any ideas?


Solution:1

I've experienced this issue recently as well. Just solved it, actually. :)

If you write a PHP function to include your tinyMCE code and run the Javascript init, you can include that in admin_head ( add_action('admin_print_scripts-widgets.php', 'NAME OF YOUR INIT FUNCTION HERE'); ).

Currently I've also go the following in my init function. although I'm not certain it's needed in this context:

wp_enqueue_script('editor'); wp_enqueue_script('editor_functions'); wp_enqueue_script('quicktags');

Hope this helps. :)


Solution:2

Does it post at all? Do a

<?php print_r($_REQUEST); ?>  

on the page its posting to, and see if value is is being passed. 99% of the time its a typing error, perhaps the textarea name is wrong.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »