Make WordPress Core

Opened 17 years ago

Closed 17 years ago

#4894 closed defect (bug) (fixed)

Atom feed invalid after initial install

Reported by: rubys's profile rubys Owned by:
Milestone: 2.3 Priority: normal
Severity: normal Version: 2.3
Component: General Keywords: atom feed validation has-patch
Focuses: Cc:

Description

Reproduction instructions: create a new WordPress blog. Immediately validate the Atom feed. The initial "This is your first post." post is without an id. Subsequent posts seem to have a correct id.

Suggested fix: default the id to the permalink. Should not break anything with a correct id.

Patch attached.

Attachments (2)

initial_post_id.patch (804 bytes) - added by rubys 17 years ago.
4894.diff (1.5 KB) - added by Nazgul 17 years ago.

Download all attachments as: .zip

Change History (9)

#1 @ryan
17 years ago

Perhaps we should manufacture a guid for them in wp_install_defaults() so that we can avoid the special case. I think we have enough info at that point in the install to create a decent guid.

#2 @ryan
17 years ago

  • Keywords atom feed validation added
  • Milestone set to 2.3
  • Version set to 2.3

#3 @markjaquith
17 years ago

  • Keywords needs-patch added

We can just use:

$first_post_guid = get_option('home') . '/?p=1';

Or to be really safe, check the ID of the inserted row after we insert it, and update it.

#4 @rubys
17 years ago

After I create the database and create another post, I get an id of:

<id>http://hostname/wordpress/2007/09/04/test/</id>

In general, should the id be based on, or independent of, the setting of Options => Permalink?

#5 @Otto42
17 years ago

In ATOM feeds, the link with rel=alternate is the permalink. The ID is supposed to simply be a globally unique ID. The most important thing about the ID is that it never, ever, changes. It's not tied to your permalink structure, as such, it's simply a unique identifier which never changes.

This is why we use the post->guid field to store it. If the permalink structure changes, the ID field won't.

So the real problem here is what ryan and mark say, we don't set a post_guid for the first post in the wp_install_defaults().

+1 to mark's suggestion. Adding a simple /?p=1 will work just fine. I'd go so far as to suggest that we make the ID always use the /?p=XX link style, but that's outside the scope of this ticket.

@Nazgul
17 years ago

#6 @Nazgul
17 years ago

  • Keywords has-patch added; needs-patch removed

Patch based on suggestion by markjaquith added.

#7 @markjaquith
17 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [6052]) Set guid when creating first post during install. Props Nazgul and rubys. fixes #4894

Note: See TracTickets for help on using tickets.