I have developed responsive theme and I want to submit it the wordpress.org. Before submitting it I want to use wp_is_mobile()
in my theme, but according to Function Reference/wp is mobile it is a bad idea because it say's this :
You should realize that this does not detect a mobile phone specifically, as a tablet is considered a mobile device. Check the Plugins area for several helpful alternatives. It also should not be used for themes.
So if I use it in my theme functions.php like this:
add_filter('body_class','mobile_theme_body_class');
function mobile_theme_body_class( $classes ){
if ( wp_is_mobile() ){
$classes[] = 'mobile';
}
else{
$classes[] = 'desktop';
}
return $classes;
}
Will my theme be rejected ?
Sub-question:
If I use my function like in the code above and use Caching Plugins like (WP Super Cache) is my function gonna be messed up (failed to execute or returning false positives) ?
Thank you for your time and answers...
wp_is_mobile()
is nothing more than a joke really and is really unreliable. It relies on user side which can be manipulated by the end user. You need to know that your functionality will fail in more than 10% of cases, so a large amount of mobile users will be dished desktop content whether or not they like it or you don't want it – Pieter Goosen May 20 '15 at 14:58