[wp-hackers] Custom Fields -- Lost by Autosave??
sharon at BrewerRadio.com
Thu Sep 17 18:20:00 UTC 2009
I've been testing some more...
It appears that a standard custom field (i.e., NOT one appended with underscore _), does not get affected the same way. Is there special handling of "hidden" custom fields? Or is there something else I'm not seeing...
From: wp-hackers-bounces at lists.automattic.com [mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Sharon Chambers
Sent: Thursday, September 17, 2009 1:29 PM
To: 'wp-hackers at lists.automattic.com'
Subject: [wp-hackers] Custom Fields -- Lost by Autosave??
I originally posted this on Wordpress.org forum, but was directed here by a moderator…
Here’s my question, I’ll be happy to forward code, login, etc, to anyone willing to help debug:
I'm writing a custom events plugin that integrates to the Wordpress edit post/page admin screen, and it works like a charm...
that is, until you leave the post open in the editor for "too long" (i'm guessing over 2 minutes, though I haven't verified this yet...that's the length of my autosave interval). Here's the gist:
My plugin adds an event box to the sidebar of the edit post/page screen using the following hooks/filters:
edit_post, publish_post, save_post, delete_post, admin_menu, manage_posts_columns, manage_pages_columns
When a post/page is published, if this event box is checked, then I write some stuff to the database and add 2 custom fields to the post/page: _bec_expiration (the expiration date of the event) and _bec_id (the db id of the event). (The underscores are so Wordpress doesn't display in the standard custom field section).
However, if I then leave the post up in the editor for a few minutes (?2 or longer?), then return and leave the page (without changing and/or updating my post), my custom fields, and hence my event information, is gone! -poof!-
I'm unable to find a hook into the autosave feature of Wordpress, and I'm unable to disable this functionality. (I already had to disable revisioning which interfered with my plugin also by pulling the post revision id instead of the post id).
1305 Carter Street
Chattanooga, TN 37402
Sharon at BrewerMediaGroup.com
Power 94.9 | Groove 93.7 | ESPN Chattanooga 105.1 | Pulse News 95.3
BOGONooga.com | ChattanoogaLivesGreen.com | ChattanoogaHasFun.com | ChattanoogaHasCars.com | ChattanoogaHasTravel.com | ChattanoogaCrime.com
ChattanoogaPulse.com, The Pulse - Chattanooga's Alternative Weekly Newspaper
Chattanooga Traffic Network:
17 Radio Stations | 3 Television Stations | Traffic Reports & Sponsorships
wp-hackers mailing list
wp-hackers at lists.automattic.com
More information about the wp-hackers