[wp-hackers] remove all functions with remove_action?

Steve Taylor steve at sltaylor.co.uk
Mon Feb 1 23:04:18 UTC 2010

I'm trying to completely remove the 'admin_notices' action, i.e.
everything attached to it, for non-admins. I'm testing for the admin
role with code specific to my custom theme, but basically I've got

if ( ! [test for admin] ) remove_action( 'admin_notices' );

It seems to do the trick, but I've noticed some non-fatal PHP warnings
being logged: "Missing argument 2 for remove_action()"

Checking the docs it does look like you need to specify the attached
function to remove. What if I want to get rid of them all, whatever
they are? This doesn't seem urgent because it kinda works, PHP warning
notwithstanding... but I thought I'd ask.


Steve Taylor

More information about the wp-hackers mailing list