Open
Description
openedon Dec 7, 2023
Description
On new posts with no content, switching to (or creating), editing then saving a template triggers the "empty_content" server error.
POST response from /index.php?rest_route=/wp/v2/posts/246&_locale=user
{
"code": "empty_content",
"message": "Content, title, and excerpt are empty.",
"data": {
"status": 400
}
}
The post is 'technically' dirty as the template slug has been updated on switch via editPost, hence the reason it appears in the saved entities list.
Alternatives in no particular order of usefulness
- Allow saving in this instance without content/title/excerpt changes
- Save only the template and "unmark" the post entity as dirty, maybe turning off template editing mode and returning to the post afterwards
- Warn the user that the post is empty 🤷🏻
Step-by-step reproduction instructions
- Open the post editor
- Switch templates using the drop down in the Template panel (right hand side). Creating a new template also triggers the error.
- Edit the template
- Make a change to the template
- Save the post (site and post entities)
- Observer the UI error message and network error (400)
What I expected
The template and post (with updated template slug) to save without error.
Screenshots, screen recording, code snippet
Creating a template:
2023-12-07.09.43.36.mp4
Swapping to a template:
2023-12-07.11.37.51.mp4
Environment info
- WordPress 6.5 alpha
- Gutenberg trunk @ 17.2
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment