[wp-hackers] remove all functions with remove_action?

Chris Jean gaarai at gaarai.com
Mon Feb 1 23:11:10 UTC 2010


You should try the remove_all_actions function.

Chris Jean
http://gaarai.com/
@chrisjean


On 02/01/2010 05:04 PM, Steve Taylor wrote:
> 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
> this:
>
> 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.
>
> thanks,
>
> Steve Taylor
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>    


More information about the wp-hackers mailing list