1

I've read the other posts about this issue, but mine is different in one fundamental way... there is no function defined in the error. It reads like this:

Warning: call_user_func_array() expects parameter 1 to be a valid callback, function '' not found or invalid function name in /home/ovbar/public_html/wp-includes/plugin.php on line 496

I've never seen this error without a function defined so I'm at a loss. I moved it using the All-in-One WP Migration plugin. Any ideas? Here's what I've done so far:

  • I've already checked for hard-coded urls just to be sure, and there aren't any.
  • Deactivating all plugins still shows this error.

Every other aspect of the site works fine. This error only displays on the front end.

Any ideas?

4
  • 1
    You could try temporarily adding debugging stuff to the core, eg at add_action in "wp-includes/plugin.php" line 431 putting if ( empty( $function_to_add ) ) echo '<pre>', debug_print_backtrace(), '</pre>';.
    – bonger
    Jan 24, 2015 at 11:53
  • I tried that, to no avail. I also tried using a try catch around the failing statement on line 496 but I get the same error. Jan 24, 2015 at 17:46
  • 1
    The try/catch should do it though if you turn it into an exception - see stackoverflow.com/questions/1241728/can-i-try-catch-a-warning
    – bonger
    Jan 24, 2015 at 18:06
  • I ended up just adding error_reporting(0); to the bottom of my wp-config file. It's only for that theme, and I'm going to be reworking it anyway. I went through the theme (poorly built) and commented out all of the add_action()s and the error still displayed, but if I switch themes it's gone. So for now, turning off warnings will do. Jan 25, 2015 at 1:38

1 Answer 1

1

I've successfully tracked this problem by adding

error_log("wp-hook: ". print_r($the_, true));

within apply_filters in wp-includes/wp_hook.php

The task is then to look at the function calls (the data inside $the_) surrounding the "PHP Warning: call_user_func_array()". It will be the one directly ahead of the warning, but you may need to look at calls after or before to determine which file is causing the problem (a filter call to an undefined function).

Note also that the problem will arise if the function exists, but has no code, like:

function create_menu() {
    //oops, there's no code here
}
add_action('admin_menu',array($this,'create_menu'));
1
  • In response to edits of my answer: I think it's important to know that the error_log needs to go in the apply_filters function in the wp_hook.php file.
    – jeromio
    Dec 29, 2018 at 20:48

Your Answer

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

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