Settings API updated messages won’t show if custom admin page not hooked into add_options_page()

Thanks Chip (excellent Settings API tutorial) and t31os (great snippet of code for quick testing) for both your suggestions.

I did some further digging and found that the default messages can indeed be displayed if I hook into any menu but only if the function settings_errors() is called.

For example, modifying t31os code as follows:

<div class="wrap">
  <h2>Test</h2>
  <?php settings_errors(); ?>
  <form action="options.php" method="post">

Custom error messages can also be added by calling the add_settings_error() function for displaying success or failure message by specifying the $type parameter as either ‘error’ or ‘updated’.

Leave a Comment