[wp-hackers] Getting a call_user_func_array() error with add_(sub)?menu_page

Dougal Campbell dougal at gunters.org
Thu Feb 4 22:15:34 UTC 2010

On Feb 4 2010 1:59 PM, Elizabeth Buckwalter wrote:
> I have a couple of plugins I'm working on.  I'm creating classes.  I copied
> code from one plugin to the other.  One plugin runs fine, the other gives me
> this error:
> *Warning*: call_user_func_array() [function.call-user-func-array]: First
> argument is expected to be a valid callback, 'MyPlugin::admin_loader' was
> given in */var/www/vhosts/campdx.com/httpdocs/wp-includes/plugin.php* on
> line *346*
> [...]
>   private function admin_loader() {
> [...]

I'd hazard a guess that declaring your admin_loader() method as 
'private' means that call_user_func_array() can't get to it. Private 
methods are only supposed to be used internally by other methods inside 
the class. If you need to be able to call it from outside, then declare 
it 'public', or determine which public method you should be using instead.

Dougal Campbell <dougal at gunters.org>

More information about the wp-hackers mailing list