views:

99

answers:

1

Hi,

I'm currently developing a Wordpress plugin. For my plugin to work I need some info te be filled in on the settings page.

  1. Is there a way to warn/throw an error so the blog admin can see this message on his/her dashbord?
  2. Is there another function to show errors other than wp_die()? Just in case my plugin (or someone else) screws up and I want to notify that in a nicely fashion. ;)
+1  A: 

I would recommend using the admin_notices action. This lets you display warnings and errors and direct your users to a page:

add_action('admin_notices','my_custom_warning');
function my_custom_warning() {
  if( true == true ) {
    echo '<div id="my-custom-warning" class="error fade"><p>This is a test</p></div>';
  }
}

This method makes sure your users can still use WordPress but will let them know where they can get information on and fix a potential problem.

nickohrn