Fatal error: Cannot redeclare wp_is_mobile()
fatal-error, wordpress
Solution
Got it!
In wp-content\plugins\sitepress-multilingual-cms\sitepress.php, there is the following lines
if ( function_exists('is_multisite') && is_multisite() ) {
include_once( ABSPATH . WPINC . '/vars.php' );
}
This lines include the file /wp-includes/vars.php where the function wp_is_mobile() is declared. Then WordPress include this vars.php file again and produce an logical error.
Before WP 3.4 release there was no visible problem as there was no functions into vars.php. But now there is.
I think wpml doesn't need to include this file as it's already include by WordPress.
So a bypass can be : Comment lines 21-24 in "wp-content\plugins\sitepress-multilingual-cms\sitepress.php"
Hope WPML can fix it more proprely in next plugin release.
Problem
I got this fatal error when I updated wordpress to Newest today. I use Barely Corporate theme. Line 126 is the last line in the code. Have anyone an Idea what this is? The theme do have a Responsive design. http://themeforest.net/item/barely-corporate-responsive-wordpress-theme/93069?WT.ac=search_item&WT.seg_1=search_item&WT.z_author=ThemeBlvd Fatal error: Cannot redeclare wp_is_mobile() (previously declared in /home/chilinbk/public_html/kunde/tkh/wp-includes/vars.php:107) in /home/chilinbk/public_html/kunde/tkh/wp-includes/vars.php on line 126 ``` if ( isset($is_mobile) ) return $is_mobile; if ( empty($_SERVER['HTTP_USER_AGENT']) ) { $is_mobile = false; } elseif ( strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile') !== false // many mobile devices (all iPhone, iPad, etc.) || strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Silk/') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Kindle') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'BlackBerry') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') !== false ) { $is_mobile = true; } else { $is_mobile = false; } return $is_mobile; ``` }