Automattic / Automattic/co-authors-plus
Slug management for guest authors
- Dominant language
- PHP
- Stars
- 322
- Forks
- 216
- Avg merge
- 7h 50m
- Merged PRs (30d)
- 65
Description
The 'slug' is how the relationship between the guest author and the 'author' taxonomy term is maintained. The 'author' taxonomy term is what's saved in relationship to the post. Thus, changing these together allows us to associate a post with a guest author.
For instance, I may have a post saved with 'daniel' as one of my 'author' taxonomy term values, or co-authors. When I use get_coauthor_by(), the code looks for a guest author with 'daniel' as the slug (actually stored in the post_name) and returns that data instead.
As of Friday the 4th of May at 5 pm, the slug is established from the user_login value when the guest author is created from an existing user, and from the 'Display Name' field the first time a new guest author is saved. We need a way of editing the slug for any guest author, but this will be more complex to do because we have to accommodate these use cases:
- Create a Guest Author, use it as-is
- Create a Guest Author, associate with user down the road
- Create a Guest Author, decide to change the slug later
- Existing user, create a guest author because user is leaving but still want post association
- Existing user, create a guest author from it because want to modify user info (WP.com or multisite only)
Slug management will have at least these requirements:
- Check to ensure a new slug doesn't conflict with other slugs
- Rename the slug and transfer ownership of the posts
- Rename the slug and leave the ownership of the posts with the old slug
Contributor guide
Research direction
Start by reading get_coauthor_by() and the existing guest-author creation and save behavior described in the issue, including how user_login and Display Name become post_name values. Map the post author taxonomy relationships before deciding how slug edits should work. Done means conflict checking and both post-transfer and keep-old-ownership cases are supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- backend, content
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100