The MU forums have moved to WordPress.org

autosave generating duplicate post (9 posts)

  1. musnake
    Member
    Posted 12 years ago #

    Took me a while to catch the error, any ideas what the fix is?

    I write a new post, add the custom field info, excerpt, author, category etc then click publish (or save). The post gets saved as post_id 13 (for e.g.)

    There is also a duplicate/earlier version of the post as post_id 12

    post ID 13 is published, tagged and in a category
    post ID 12 unpublished, tagged, uncategorized and in Draft

    This seems to be an issue with autosave. If I rush the creation and save of the post (to beat autosave) I do not get a duplicate.

    Any ideas? Not using the visual editor as this user.

  2. musnake
    Member
    Posted 12 years ago #

    I see that the autosave interval can be set in \wp-settings.php

    Instead of increasing the autosave period, I want to fix the lock/check issue.

    I see that wp-admin/admin-ajax.php does much of the autosave stuff. Does that file need extra loose permissions to do its ajaxy stuff?

    I did a diff on my files and a fresh download of 1.5.1 with no related differences.

    Any ideas?

  3. musnake
    Member
    Posted 12 years ago #

    Yup, everytime autosave runs it creates a new post_id.

    If the code is the same as vanilla, it points to a plugin, mu-plugin or db schema issue.

    Besides wp_1_posts and wp_1_postmeta tables, should I check other schema (which tables)? All the tables have been repaired etc.

    sigh.

  4. ChrisCree
    Member
    Posted 12 years ago #

    I noticed WordPress 2.5.1 do the same thing. If I type in the title of my post and then immediately click "save" before the first auto save takes place I get a duplicate post with the same title.

    I found that if I tab from the title field down to the post edit box and give WP a second to auto save before I go near the save box then I don't have a problem. Just required a tiny change in habit for me.

  5. musnake
    Member
    Posted 12 years ago #

    Hmmm, interesting, Chris.

    I can not reasonably expect my users to adjust in this way, plus there is the fact that something has changed as this did not happen in the past. My mind has even led me down the garden path of FF addons (web developer etc) interfering in someway... unlikely for many reasons.

    Ok, let me check the mu-plugins again...

  6. musnake
    Member
    Posted 12 years ago #

    Yup, with the mu-plugins directory renamed to something else (in my mind the equivalent of deleting that folder, am I wrong?) and ALL plugins in the plugins directory deactivated, the duplicate post issue persists.

    If I create a new post, enter a title, as soon as I click in the main text edit area an autosave event is triggered.

    If I leave the post's status as unpublished and continue editing for more than two autosave events I get a duplicate entry. That is, If I finally set the new post's status to published and save, I get the published post and an unpublished draft, as long as the editing session was greater than 2 autosave events (2 mins).

    If I save within 1 minute I do not get the ghost draft.

    Time (no pun intended) to find where the conditional check for time since last edit vs. time last saved occurs.

    I have to leave to go out of town in an hour or two so will put this on hold for now.

    Pointers? Something in the server config (as there are no plugins interfering)?

  7. richardxthripp
    Member
    Posted 12 years ago #

    The bug is with custom fields; it won't happen if you don't use them.

    http://trac.wordpress.org/ticket/6457

    Says it will be fixed in 2.5.2 (1.5.2 for MU). If none of your users use custom fields, they won't encounter the bug.

  8. ChrisCree
    Member
    Posted 12 years ago #

    Thanks Richard. I don't mind the work around myself. Even so, it's good to see it will be fixed in the next version 'cause I use custom fields on a lot of my stuff.

  9. musnake
    Member
    Posted 12 years ago #

    Awesome, thanks Richard.

    Running into a bug? Moi? I feel so, included!

    Thanks for the links to the patches.

About this Topic