Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback

Viewed 516

For a custom theme, I created the ACF fields functions. They all worked before I updated PHP to 8.0. I checked everything I could, and read many examples, but can't figure out what exactly is not working.

This is the error: Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, array must have exactly two members in /nas/content/live/spectrasandbox/wp-includes/class-wp-hook.php:307

This is where I use a call_user_func() :

public function __get( $key ) {
        switch ( $key ) {
            case 'locations':
                return call_user_func( 'acf_get_location_types' );
        }
        return null;
    }

function acf_dev_log() {
    if( defined('ACF_DEV') && ACF_DEV ) {
        call_user_func_array('acf_log', func_get_args());
    }
}

public function __call( $name, $arguments ) {
        switch ( $name ) {
            case 'register_location':
                return call_user_func_array( 'acf_register_location_type', $arguments );
            case 'get_location':
                return call_user_func_array( 'acf_get_location_type', $arguments );
            case 'get_locations':
                return call_user_func_array( 'acf_get_location_rule_types', $arguments );   
        }
    }

if( is_callable( $block['render_callback'] ) ) {
        call_user_func( $block['render_callback'], $block, $content, $is_preview, $post_id );
    
    }

0 Answers
Related