Add CSS Class Info to post_updated_messages array/filter
|Reported by:||cgrymala||Owned by:|
When saving a post, not all messages displayed on the screen are "success" messages. Some are errors or warnings. Therefore, it would be nice to have the ability to modify the CSS class that's applied to the notice message.
In order to support backwards-compatibility, I would suggest allowing the array that's built using the post_updated_messages filter to support strings (which would be the message text by itself) or arrays (which would include one item for the message text and one item for the message class).
If a string is found, that string is assigned as the message text. If an array is found, the first item is assigned as the message text and the second item is assigned as the message class.
If a message class is not defined, the CSS class of 'updated' is used; if it is found, the specified CSS class is used.
I've attached a patch for wp-admin/edit-form-advanced.php showing basically what I'm proposing. In this case, if an array is sent as the value of one of the messages, that array is expected to use the keys "message" and "class"; but it could certainly be edited just to use numeric keys if that might make more sense.