Current behavior
When saving a snippet with code errors, the editor showed a success notice even though the snippet couldn't be activated, and the code_error field was lost.
Expected behavior
When saving a snippet with code errors:
- The snippet is saved to the database
- The snippet is not activated (remains inactive)
- The REST API response includes the code_error field as [message, line_number].
- The editor receives and parses code_error from the response.
- The user should see clear feedback that the snippet was saved but could not be activated due to code errors, with the error details available in the snippet object.
Steps to reproduce
- Create a new php snippet with an error
- Click Save and Activate
A success notice appears but the snippet was not activated.
WordPress version
6.9
Code Snippets version
3.9.3
Code Snippets license
Core (free)
Anything else?
No response