Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm going to test the user agent to load a mobile template instead of the desktop theme.

There are many mobile detection scripts out there.

  • Does wp_is_mobile() function work well?
  • What is your experience in comparison with other classes like e.g. mobiledetect.net?
share|improve this question
add comment

2 Answers

up vote 8 down vote accepted

Yes it works well. It's a very simple function but never found a mobile device not recognized by it. It recognize the 90%+ of mobile devices. Main difference from mobiledetect.net is that doesn't differe from phone and tablets.

See the code

share|improve this answer
    
thank you, as always G.M. provides pro answers :) –  Andrea Puiatti Aug 26 '13 at 14:46
    
thank you, Andrea @AndreaPuiatti –  G. M. Aug 27 '13 at 0:23
add comment

Yes, the wp_is_mobile() works well, but you can run into problems when using aggressive caching systems, such as fastcgi, proxy cache, etc. that skip the php execution.

If that is the case, I would recomend some client side (javascript) detection method that is loaded for both mobile and desktop browsers.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.