While getting my little side project, Recipe Hero, ready for it’s 1.0.0 debut, I was faced with a small issue. I wanted to custom the admin notices that appear after saving / updating / scheduling, etc. a Recipe.
The recipes in the plugin are not surprisingly made with a custom post type for recipe, but by default, WordPress just uses the standard post updated messages for all custom post types.
The following is an example of the code you’d need to achieve this. It’s some code straight from Recipe Hero, so you’ll want to customise it a little bit.
Specifically line 8, where the post type is defined, and then of course each message so that it reflects your post type better! Don’t forget to change that recipe-hero text domain too, so the strings are translatable.
For reference, the WordPress.org Function Reference for
register_post_type actually explains this extremely well, with a very detailed (and slightly more complex) code snippet.