Warning: call_user_func_array() expects parameter 1

When you get this type of error on WordPress, there’s a huge percentage of probability that your theme is broken.  You normally get this type of error because a function on the functions.php for your theme is missing but there’s still the call for that function.

For example, let’s say you wanted to delete a function you’re not going to use anymore that is currently declared on your theme:

add_action('wp_loaded','my_function');
function my_function () {}

Normally you would delete or comment out the function declaration for my_function.  But if, for any reason, you forget to delete the add_action call, then you’re going to start seeing errors related to the call_user_func_array() on wordpress.

This normally happens when you have an add_action for that function in a different part of the code and you forget about it when deleting your function.

This error is very difficult to detect and solve as it doesn’t show which function is missing and where is the wrong add_action on the code.

To solve it, just comment one by one all the add_action calls that you suspect are causing the error, until you see the error go away.   Then you will know which deleted function was causing the problem.

PD: This error could be also related to plugins authors that declared a function on a previous version of their plugin and then on a newest version they delete it but forget to delete the action related.

 

3 thoughts on “Warning: call_user_func_array() expects parameter 1

Leave a Reply