[wp-hackers] How to create relations between custom post types?

Mike Schinkel mikeschinkel at newclarity.net
Sun May 30 04:12:38 UTC 2010


On May 29, 2010, at 11:52 PM, Michael Pretty wrote:
> 
> I was implementing this for a radio station.  The specific post type that needed to be created were individual shows.  They needed a way to associate posts with those shows, so there was a show taxonomy and each show had it's own term.  I first attacked the problem by trying to make the show term that represented each show have the same slug as the show did.  The issue we had with this was when the client would create more than one copy of the same show with the same title.  Only one would be published, but they would have a copy sitting in draft or in the trash for some reason or another.  When this happened, it was often the show in the trash or in draft that would be the one that was created first, and in turn, it would get the term that matched the name of the show.  This would cause the show that was actually published to end up creating a term that had a slug of "the-show-title-2" instead of "the-show-title".  So then when we tried to get the matching term based on the show's post_name, it didn't match up because of the -2.  There were similar issues if the name of a show was changed.

Thanks a bunch for explaining.  it was a lot of writing but that kind of use-case discussion is really helpful for me and I expect for future people googling for these issues.

Sounds like your client is running into the issue that this ticket was created to address?

http://core.trac.wordpress.org/ticket/11863

Of the three WP3.0 projects I'm currently working on I've run into trouble with trashed slugs keeping the user from achieving what they want in all three projects, and either having the users get really frustrated or confused by it and/or I then tell them they have to click many times to resolve each post (once they realize what the problem is, which is rarely obvious to them.) 

Often they don't realize they've created a problem until a while after they created the post that got assigned a slug other than what they wanted/expected. Unfortunately  the consensus on the ticket was to favor the trashed post and not the new post.  If my three projects are any indication a lot of people will experience similar frustrations and if so I hope the deciders will be willing to rethink the resolution.

-Mike


More information about the wp-hackers mailing list