Warning: call_user_func_array() expects parameter 1 to be a valid callback…

Warning: call_user_func_array() expects parameter 1 to be a valid callback

This is a recurring error when dealing with actions/filter in WordPress.

The full warning message is actually : Warning: call_user_func_array() expects parameter 1 to be a valid callback array must have exactly two members in…/wp-includes/plugin.php on line 214

 

In my case, it is usually caused by a filter or an action not properly declared. Typically a parenthesis  at the wrong place like :

add_action ( 'action_tag' , array( $this , 'my_callback , 30 ) );

See the problem ?

The priority must be outside the callback array parameter as follow :

add_action ( 'action_tag' , array( $this , 'my_callback ) , 30 );

 

10 thoughts on “Warning: call_user_func_array() expects parameter 1 to be a valid callback…”

Comments are closed.