NielsVee Posted March 23, 2023 Share Posted March 23, 2023 I took over a couple of website from a former webdesigner who wanted to quit and now I am transitioning the websites from Joomla to Wordpress. She sent me all the templates that I should be able to import in WP. When I do import a theme, I break all of WP. I checked everything and it is indeed the theme. With WP recovery mode I was able to determine the specific file and lines that are causing the trouble. The file is functions.php and the problem is this piece of code: function theme_get_option($name) { global $theme_default_options; $result = get_option($name); if ($result === false) { $result = theme_get_array_value($theme_default_options, $name); } return $result; } The bolded function is undefined and causes trouble. I tried to change it into array_values which WP should be able to read, but it didn't work. I am hoping that one of you cool people could help me. Quote Link to comment https://forums.phpfreaks.com/topic/316038-problem-with-wordpress-template/ Share on other sites More sharing options...
requinix Posted March 23, 2023 Share Posted March 23, 2023 It sure looks like that function used to exist, but I can't find it anywhere in WP's history... It's probably a dumb function anyway: try replacing the line with $result = $theme_default_options[$name]; Quote Link to comment https://forums.phpfreaks.com/topic/316038-problem-with-wordpress-template/#findComment-1606771 Share on other sites More sharing options...
NielsVee Posted March 25, 2023 Author Share Posted March 25, 2023 Thanks for your quick response. I tried to fix it, but it seems like it didn't work. I now found out about the debugging mode of Wordpress and it gave some guidance on where to look. I fixed the theme issues, but now I get a different error that makes me think my Wordpress install isn't good anymore. This is the current error: [25-Mar-2023 21:28:36 UTC] PHP Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, function "theme_widget_process_control" not found or invalid function name in /wp-includes/class-wp-hook.php:308 Stack trace: #0 wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array) #1 wp-includes/plugin.php(517): WP_Hook->do_action(Array) #2 wp-includes/class-wp-customize-widgets.php(342): do_action('sidebar_admin_s...') #3 wp-includes/class-wp-hook.php(308): WP_Customize_Widgets->customize_controls_init('') #4 wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array) #5 wp-includes/plugin.php(517): WP_Hook->do_action(Array) #6 wp-admin/customize.php(112): do_action('customize_contr...') #7 {main} thrown in wp-includes/class-wp-hook.php on line 308 Which refers to this function: 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 ] = current( $this->iterations[ $nesting_level ] ); $priority = $this->current_priority[ $nesting_level ]; foreach ( $this->callbacks[ $priority ] as $the_ ) { if ( ! $this->doing_action ) { $args[0] = $value; } // Avoid the array_slice() if possible. if ( 0 == $the_['accepted_args'] ) { $value = call_user_func( $the_['function'] ); } 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; } The highlighted part is line 308. It seems fine to me, but I am in no way a PHP expert. Quote Link to comment https://forums.phpfreaks.com/topic/316038-problem-with-wordpress-template/#findComment-1606835 Share on other sites More sharing options...
maxxd Posted March 26, 2023 Share Posted March 26, 2023 It appears the function theme_widget_process_control is part of a theme created by Artisteer called ThinkTank (specifically in the widgets file). Did you recently change themes? Quote Link to comment https://forums.phpfreaks.com/topic/316038-problem-with-wordpress-template/#findComment-1606838 Share on other sites More sharing options...
NielsVee Posted March 26, 2023 Author Share Posted March 26, 2023 The previous webdesigner didn't change themes recently. She basically converted her Joomla theme to a Wordpress theme and set them to me. I already transitioned one of the websites without any trouble. But this one seems to be a bit different. She used the same template for all of the sites and changed the styling. Quote Link to comment https://forums.phpfreaks.com/topic/316038-problem-with-wordpress-template/#findComment-1606841 Share on other sites More sharing options...
maxxd Posted March 26, 2023 Share Posted March 26, 2023 Is it a child theme, perhaps? The error you're getting says the function `theme_widget_process_control` isn't found; that's not a function in the WP base code. Not actually sure where the `theme_get_array_value` error is that you pointed out in your first post as that doesn't appear in the error message you quoted later, but I don't recognize that as a WP core function either. Admittedly, it's been a bit since I've been deep into WP. Quote Link to comment https://forums.phpfreaks.com/topic/316038-problem-with-wordpress-template/#findComment-1606844 Share on other sites More sharing options...
NielsVee Posted March 29, 2023 Author Share Posted March 29, 2023 I have found the a fix for my problem. I had to change a line in the Wordpress Base code to make my theme compatible again. https://wordpress.stackexchange.com/questions/406260/wordpress-6-0-class-wp-widget-php-fatal-errors-in-php-8-1-6 This is the fix I applied and all of the sudden the theme worked again. Quote Link to comment https://forums.phpfreaks.com/topic/316038-problem-with-wordpress-template/#findComment-1606944 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.