'Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given

I am on my WordPress website and these duplicate messages pop up on my dashboard. I am using WordPress 4.7.1. I do NOT have the FeedWordPress plugin on my site as I saw they had an issue with this error as well.

Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in /home/mydomain/public_html/wp-includes/class-wp-hook.php on line 298

Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given in /home/mydomain/public_html/wp-includes/class-wp-hook.php on line 298

This line is 298

$value = call_user_func_array( $the_['function'], $args );

This is the function that contains line 298

public function apply_filters( $value, $args ) {
    if ( ! $this->callbacks ) {
        return $value;
    }

    $nesting_level = $this->nesting_level++;

    $this->iterations[ $nesting_level ] = array_keys( $this->callbacks );
    $num_args = count( $args );

    do {
        $this->current_priority[ $nesting_level ] = $priority = current( $this->iterations[ $nesting_level ] );

        foreach ( $this->callbacks[ $priority ] as $the_ ) {
            if( ! $this->doing_action ) {
                $args[ 0 ] = $value;
            }

            // Avoid the array_slice if possible.
            if ( $the_['accepted_args'] == 0 ) {
                $value = call_user_func_array( $the_['function'], array() );
            } elseif ( $the_['accepted_args'] >= $num_args ) {
                $value = call_user_func_array( $the_['function'], $args );
            } else {
                $value = call_user_func_array( $the_['function'], array_slice( $args, 0, (int)$the_['accepted_args'] ) );
            }
        }
    } while ( false !== next( $this->iterations[ $nesting_level ] ) );

    unset( $this->iterations[ $nesting_level ] );
    unset( $this->current_priority[ $nesting_level ] );

    $this->nesting_level--;

    return $value;
}

Is this a serious warning? If so, how would I fix this?



Solution 1:[1]

Just to update this thread - I had the same error upgrading to 4.7.2. I deactivated my plugins one by one and found one to cause the problem

Solution 2:[2]

You said that you deactivated some plugins and that fixed it. What plugin was causing the issue,cuz I am getting the same thing

Solution 3:[3]

I had the same issue. I disabled the Slider Revolution plugin and it fixes the issue.

Hope it helpful!

Solution 4:[4]

This warning occurs when you add a function instead of a string in the callback argument of wordpress action hook.
For an example:
This will cause the warning:

add_action("wp_enqueue_scripts",somefunction());

But this will not:

add_action("wp_enqueue_scripts","somefunction");

Or, This warning can also occur if the file containing that "somefunction" was not included.

These were the cases the warning was reproduced by me.

Solution 5:[5]

I am not getting the exact solution, but I got a temporary solution for immediate basis, just hide it, I use the function on the top of the file after <?php start. It disables the warning.

define('WP_DEBUG_DISPLAY', false); //It's work for me
                

You may also try

ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jocelyn
Solution 2 Mark Chauvin
Solution 3 g00glen00b
Solution 4
Solution 5 Suraj Rao