- This topic has 6 replies, 1 voice, and was last updated 1 month ago by HUisSebastian.
November 9, 2023 at 12:25 pm #487042KazGuest
mobile theme error with WP 6.4 or higher
I have found a problem with a fatal error in the theme for mobile when WordPress is updated to version 6.4 or higher.
It seems that when a mobile theme is selected, the desktop theme is also loaded first, causing the error due to the absence of files or the inability to redefine scripts.
I have worked around it by downgrading WordPress to 6.3, but it has not been a radical solution.
Any help would be much appreciated!
KazNovember 9, 2023 at 1:10 pm #487043Agustín MustielesGuest
I have the same issue.November 9, 2023 at 6:12 pm #487065DineshKeymaster
I just checked our plugin with WordPress 6.4.1. and couldn’t find any fatal error at all. And the theme switching is working fine here. Tested with default wordpress theme.
Can you send me the error messaging you are getting ?
ThanksNovember 10, 2023 at 10:43 am #487119justinGuest
Just an assumption, but I think whoever has an error after the latest version of wordpress is the “can not redeclare function” error(same with @Kaz). I am also having the same problem and rolled back my wp version to 6.3.2 to fix it temporarily. Please fix!November 10, 2023 at 11:18 am #487120DineshKeymaster
Please send us the exact error message so that we can work on it. So far i am unable to replicate the issue here.
Also. here is the scenario i am testing with. https://wordpress.org/support/topic/wordpress-6-4-the-plugin-no-longer-works/#post-17190308
ThanksNovember 10, 2023 at 11:36 am #487121justinGuest
PC version : theme_1
Smartphone version : theme_2
On the smartphone version this error pops up. PC version is fine (probably due to loading algorithm)
‘Fatal error: Cannot redelcare “sample_function_a()” previously declared in “/path/to/theme_1/functions.php” in “/path/to/theme_2/functions.php” on line xxx
There has been a critical error on this website.’November 10, 2023 at 2:17 pm #487127HUisSebastianGuest
Wrote a wall of text including a fix over at https://wordpress.org/support/topic/wordpress-6-4-the-plugin-no-longer-works/ . Basically, if one of the functions get_template_directory() or get_stylesheet_directory() BEFORE the plugins_loaded hook messes up the correct functioning of Any Mobile theme switcher. In my case, it was the Plugin Meta Box that was the culprit, but it could be any plugin that doesn’t wait until the plugins_loaded hook to call these functions.