$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>migration - call_user_func_array() error on front end|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

migration - call_user_func_array() error on front end

matteradmin10PV0评论

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?

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?

Share Improve this question edited Jan 24, 2015 at 8:27 Pieter Goosen 55.5k23 gold badges117 silver badges211 bronze badges asked Jan 24, 2015 at 8:16 KingRichardKingRichard 1771 silver badge11 bronze badges 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 Commented 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. – KingRichard Commented Jan 24, 2015 at 17:46
  • 1 The try/catch should do it though if you turn it into an exception - see stackoverflow/questions/1241728/can-i-try-catch-a-warning – bonger Commented 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. – KingRichard Commented Jan 25, 2015 at 1:38
Add a comment  | 

1 Answer 1

Reset to default 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'));
Post a comment

comment list (0)

  1. No comments so far