0

do you know why i am missing argument 2 for this function?

add_action( 'admin_notices', 'notice_handler', 10, 2);

function notice_handler($error_token, $error_tag) {

    ...
    }
}

but when i activate the plugin wp says: Warning: Missing argument 2 for notice_handler()....

1 Answer 1

2

The action is called without any variables:

do_action('admin_notices');

So you don’t get $error_token and $error_tag.

3
  • Thank you, I was actually trying to look for the number of variables which it can have. So can I ask if i can replace that action with another? Basically I'm trying to make a plugin which handles the errors of some of my custom plugins.
    – Tony
    Commented Feb 16, 2012 at 15:04
  • Why can't you just invoke those variables inside your callback? Commented Feb 16, 2012 at 15:08
  • No, because the others plugins when find an error set an option with option_update. Now in the function hooked by <CODE>do_action('admin_notices');</CODE> in another plugin i would like to be able to retrieve the name of the option and so pass it to get_option($var). Is that possible....i may be wrong on this.
    – Tony
    Commented Feb 16, 2012 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.