WordPress.org

Ready to get started?Download WordPress

Forums

draft auto-save not saving my custom fields (2 posts)

  1. derzok
    Member
    Posted 4 years ago #

    Hi, I'm writing a plugin that will display a checkbox on the edit post screen of the admin menu. If the checkbox has been checked and the post is submitted, it gets added to a table in a database. If it is NOT checked, it's removed from the database (if it exists). That all works wonderfully.

    The problem is when I leave the browser on the edit post screen, it runs an auto save function which for some reason, ignores the custom checkbox field I've placed on the edit post screen (causing the entry to be erased from the database - even when the box IS checked).

  2. schneidley
    Member
    Posted 4 years ago #

    i too have discovered a similar issue. i spent a whole day trying to figure out why my custom meta box values were sometimes disappearing, seemingly on their own. the part that had me most confused was that the data would save to the database, and as long as i was jumping around trying to replicate the problem and checking to see if it had happened, everything was fine. but the moment i would sit still for a few min... POW! all custom meta values for one post was gone! i finally realized it was happening when a post auto saved! whatever post's edit page i was sitting on would be the effected post. now that i have figured it out, it makes total sense... the problem is i have no idea how to fix it. i added an action to run the meta save function whenever "save_post" happens, but clearly, this does not include auto-save... it seems to me, the best solution for me (short of hacking the core to include the auto-save in save_post) is to add a second action, running the meta save function whenever the auto-save runs... the catch: i still haven't found that function. can anyone tell me what it is? this cannot be a unique issue... and i imagine there must be an appropriate patch on wordpress' part, but for now, i just need something that works

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags