WordPress bug – duplicate page entries

This bug was fixed in WordPress 2.8 [changeset]

While working on a new site design, I found an interesting bug in WordPress 2.7. I created two new pages to use as "Front page displays", one called Blog and one called Home. To create the pages, I clicked on Pages > Add New, entered a Title and clicked Publish.

I then went to my Reading Settings (Settings > Reading) and set the static Front and Posts page to the pages I just created. Going back to my site, I tested out the new static pages only to find they didn't work.

After a lot of time and troubleshooting, I noticed on the Pages screen that there were two copies of each page I had created - with one still labeled as a Draft. After even more time troubleshooting, I finally discovered the issue. Unlike the Posts page, the Publish and Save Draft buttons are not disabled during an autosave. So, when I entered the Page title and clicked Publish, the autosave and publish requests were happening at the same time.

I opened a WordPress ticket and submitted a patch. The patch was applied by azaozz, but it looks like it won't be available until WordPress 2.8. To fix this bug yourself, open /wp-includes/js/autosave.js and change all occurrences of #submitpost to .submitbox:

function autosave_enable_buttons() {
	jQuery(".submitbox :button:disabled, .submitbox :submit:disabled").attr('disabled', '');

function autosave_disable_buttons() {
	jQuery(".submitbox :button:enabled, .submitbox :submit:enabled").attr('disabled', 'disabled');
	setTimeout(autosave_enable_buttons, 5000); // Re-enable 5 sec later.  Just gives autosave a head start to avoid collisions.

Now the buttons will be disabled during an autosave, just like it does on the Posts page.


  1. February 14, 2009 @ 9:54 am #

    WordPress 2.7.1 is out now, does that fix it?

  2. February 26, 2009 @ 9:56 pm #

    @Ec30 - unfortunately, it was not added to the 2.7.1 release. Not sure why, though...

  3. March 6, 2009 @ 5:43 pm #

    I did the same thing -- haven't applied this code, but now I have duplicate "home" pages in the title bar now. Did you end up with duplicate page titles as well? If so, how did you fix them?

  4. March 11, 2009 @ 10:25 pm #

    @Carey - It's been a while, but I believe I had to delete them and start over.

  5. March 13, 2009 @ 11:53 pm #

    Yes..why it not was added in 2.7.1 ?

Leave a Comment

Sorry, comments are closed. You can contact me directly, if you like.

Eric Martin