This is a tricky one. You don’t really need to look at wp-includes/plugin.php, there is nothing wrong with that file, it’s a core file so you should just leave it alone, like all the other core files.
The reason it’s tricky is because actions and filters in core expect a working callback function, but when you add_action
or add_filter
it never really validates the callback. In fact, it never validates it when doing do_action
and apply_filters
either, but instead it’s passing it straight to call_user_func_array
.
So whenever you see this error (or it’s non-array sister errors), it simply means that some theme or plugin is doing something wrong with add_action
or add_filter
:
add_action( 'init', 'function_that_does_not_exist' );
add_action( 'init', array( 'Class_Name', 'method_that_does_not_exist' ) );
add_action( 'init', array( 'Non_Existent_Class', 'method' ) );
add_action( 'init', array( 'Class_Name', 'method', 'huh?' ) );
add_action( 'init', array( 'Just a bogus array' ) );
Your specific error is the case #4, which is passing a callback as an array, but has more than 2 values in the array, and that’s what PHP is complaining about. It’s a pretty common mistake with WordPress actions, priorities and arguments:
add_action( 'foo', array( $this, 'bar', 10, 2 ) );
See, it sort of looks like we attached to foo
with our bar
method at priority 10 with two arguments. But in reality we’re passing an array of four elements as the callback function. This is what we really intended to do:
add_action( 'foo', array( $this, 'bar' ), 10, 2 );
Note how the callback is a 2-element array, and 20 and 2 are the third and fourth arguments to add_action
.
Hope that sheds some light onto what’s happening with your plugins.