I have a working front end posting system on my site that initially I designed with a simple text area for the content. I am now attempting to swap the textarea out with the TinyMCE function, wp_editor. I can easily get the editor to display and function properly, but on the submission of the form, the content is saved/not saved in a strange way.
The behavior is as follows:
When I attempt to publish the post the first time, the content does not seem to save, leaving the textarea blank.
If I edit the post and save it again, the OLD content (from the first save) magically reappears and the new stuff is gone. After that, it randomly gives me either nothing or the old content only.
I’ve looked around, but was only able to find this question: wp_editor textarea value not updating which doesn’t exactly apply to my situation and I’m not sure that any of those solutions are really what I need.
I’m not sure what code would be best to help troubleshoot, but here is my original text box:
<textarea name="user_post_content" id="user_post_content" placeholder="Enter your content..." class="inputwide"><?PHP echo ((!empty($post_obj->post_content))?$post_obj->post_content:''); ?></textarea>
And here is what I want to replace it with:
<?php wp_editor($post_obj->post_content, 'userpostcontent', 'textarea_name=user_post_content' ); ?>
Here is a pastebin of the entire page template file: http://pastebin.com/tncmQGDA
Hopefully someone can help.
Check with a array for the settings –
$settings
(array) (optional) An array of arguments. – on the functionwp_editor
.I was working on same kind of project and find this jquery plugin useful
http://jhtmlarea.codeplex.com/
Regards
Well, I got it corrected. It looks like it was because my post form uses javascript for errors and confirmation messages. I finally go a hold of the original developer who made this for me and he added this:
Which made this function work correctly:
Seems so simply now that it’s done….
Thanks for all your suggestions though!