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

34.3k Views Asked by At

https://i.stack.imgur.com/HdkBR.png

Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($function) must be a valid callback, class Wcore_Admin does not have a method "sitemap_exclude_post_type" in /var/www/html/wp-includes/class-wp-hook.php:292 Stack trace: #0 /var/www/html/wp-includes/plugin.php(212): WP_Hook->apply_filters() #1 /var/www/html/wp-content/plugins/wordpress-seo/inc/sitemaps/class-post-type-sitemap-provider.php(276): apply_filters() #2 /var/www/html/wp-content/plugins/wordpress-seo/inc/sitemaps/class-post-type-sitemap-provider.php(253): WPSEO_Post_Type_Sitemap_Provider->is_valid_post_type() #3 /var/www/html/wp-includes/class-wp-hook.php(294): WPSEO_Post_Type_Sitemap_Provider->save_post() #4 /var/www/html/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters() #5 /var/www/html/wp-includes/plugin.php(484): WP_Hook->do_action() #6 /var/www/html/wp-includes/post.php(4384): do_action() #7 /var/www/html/wp-admin/includes/post.php(690): wp_insert_post() #8 /var/www/html/wp-admin/post-new.php(66): get_default_post_to_edit() #9 {main} thrown in /var/www/html/wp-includes/class-wp-hook.php on line 292 There has been a critical error on this website. Please check your site admin email inbox for instructions.

My server has been upgraded from PHP 7.4 to 8.0.8. I know it causes because of one of the plugins named wcore admin which was developed by custom. And It's required plugin to do our jobs. I'm looking for a way to fix the issues and maintain the script myself since I'm very happy with it.

3

There are 3 best solutions below

1
On

You should try

call_user_func_array([new $this->controller, $this->action], array $args);
1
On

I faced same issue on upgrade to php8.0, the error shows steps to debug

'class Wcore_Admin does not have a method "sitemap_exclude_post_type"'

the plugin or file class name Wcore_Admin does not have a function named sitemap_exclude_post_type. Remove the line calling a missing function, and it should work

0
On

I have changed the php version to 7.4.30 and this solved my issue