Passing error/warning messages from a meta box to admin_notices

Posted by Prem Tiwari | Updated on

You can do this by hand, but WP natively does it like this for settings errors:

  1. add_settings_error() to create message.
  2. Then set_transient('settings_errors', get_settings_errors(), 30);
  3. settings_errors() in admin_notices hook to display (will need to hook for non-settings screens).

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers