Autosave forces 'Uncategorized' within seconds
Issue Overview
When creating a new post, no category should be applied until the author has interacted with the save / publish button to avoid the Uncategorized category being applied to every post.
Steps to Reproduce (for bugs)
- Create new post.
- Add title.
- Watch the Uncategorized category be applied
- Throw your computer out the window.
- Regret step 4.
Expected Behavior
When creating a new post, no category should be applied until the author has interacted with the save / publish button to avoid the Uncategorized category being applied to every post.
Current Behavior
Within seconds of giving a new post a title, the post is given the 'Uncategorized' category.
Possible Solution
Not sure.
You and me both, but it's a core issue. I'm fine with that behaviour going away, but it needs to be fixed in wp_insert_post(), which enforces that post post types have at least one category.
Ref: https://core.trac.wordpress.org/ticket/14901
- throws computer out the window *
@mor10 With Classic Editor the default category is also set by core for an autosaved post, but the category is not automatically checked/shown in UX while still editing the post. Nothing is checked.
With Gutenberg you need an additional click (uncheck default if you set another category), so it is clearly a Gutenberg issue.
I've done some user testing. This is most definitely a Gutenberg issue. @pento, can you re-open the ticket or should I file a new one?
Specifically, this issue is made more prominent by the default behavior of the publish panel. When a new post is created, the creator sees the simplified panel with the Publish button, but is not aware of the categories etc unless they explicitly close that panel and make a change. The result is almost everyone I've tested this on (myself included), accidentally publishes posts without setting the category and then have to go back and fix it after publishing. It's a bad user flow.
@tkes: That's a bug in Classic Editor - the UI isn't updated to reflect the actual state of the post. Gutenberg is behaving correctly in that respect.
@mor10: Please open a new issue for the user flow problem, we can leave this issue as a monument to Core's hilariously quirky default behaviour..
That's a bug in Classic Editor - the UI isn't updated to reflect the actual state of the post. Gutenberg is behaving correctly in that respect.
Calling this a bug doesn't seem correct. It also seems wrong to conflate this with wp_insert_post() enforcing category assignment.
It's a good thing the category UI isn't updated to reflect the state of the post prior to saving in the Classic Editor. This saves a pointless click to dissociate Uncategorised as a category each time a new post is created.
Perhaps the original issue could have been: "When creating a new post, the category UI should not be updated until the author has interacted with the save / publish button to avoid the Uncategorized category being applied to every post." This matches the experience in Classic Editor: Uncategorised is assigned as a fallback where no category has been assigned by the user.