Show custom notice message after post is saved in Gutenberg with custom meta boxes in it?
I have a custom post type that still uses custom meta boxes. Before Gutenberg a custom notice was shown if some of the custom meta fields failed to validate when the post was saved.
This of course doesn’t work anymore with Gutenberg, but I’m having a hard time figuring out how to make it work in Gutenberg itself.
I found the code how to check if a post is being saved, and how to create a notice. But what I would like is to only show a notice if some of the meta fields fail to validate in the back end and show a custom message in the notice based on why it failed.
I may have overlooked it, but I don’t see anything in the official Gutenberg documentation about this. Can what I want only work if I convert the custom meta boxes into Gutenberg blocks?
If someone can point me in the right direction how to validate the meta fields in Gutenberg, and based on them failing the validation show a notice, then that would help a lot 🙂
Leave an answer