Setup:
- WordPress Add/Edit Post/Page
- A plugin that have its own postbox with several hidden fields.
Issue:
How these custom hidden fields can be saved along with the other post data within the Autosave feature?
Thanks
Setup:
Issue:
How these custom hidden fields can be saved along with the other post data within the Autosave feature?
Thanks
Comments are closed.
I have just made a plugin that needed to be autosaved, so i started to dig into the code. I did now that it have to be trigged by some javascript so started to look into the console in Chrome when autosave fires. I then saw that
autosave.js
looks for a classtags-input
in admin-filters.php you can see the comment:So i just added the class
tags-input
to my hidden fields and it now saves when autosave fires!Here is my example:
<input type="hidden" class="tags-input" name="key" value="value" />
Update:
Now you have to add your data by your own ajax function. (add a new js-file and include in footer. admin_enqueue_scripts)
And the saving: