[wp-hackers] How to send notification messages in wordpress?

Dougal Campbell dougal at gunters.org
Fri Mar 11 14:56:22 UTC 2011


On Mar 10 2011 6:05 AM, john wrote:
> Is there anything comparable to cakePHP's setFlash in WP? I've got a 
> multiform plugin and I simply want to notify users of their actions 
> inside a div at the top of each page. Any Ideas how to go about this? 
> I've read a little about WP_Error, but these aren't error messages... 
> merely things like "Image Upload Successful!" etc.
>
Hook into the 'admin_notices' action, and output a div with class 
'update-nag'.

add_action('admin_notices', 'my_alert');
function my_alert() {
   echo "<div class='update-nag'>Git 'er done!</div>";
}


-- 
Dougal Campbell <dougal at gunters.org>
http://dougal.gunters.org/
http://twitter.com/dougal
http://twitual.com/


More information about the wp-hackers mailing list