Should wp_is_mobile work propery with mobile cache?




Wordpress LScache Plugin: Should wp_is_mobile work propery with mobile cache?

Last Updated on: Wed, 15 Apr 2026 00:00:02
Hello, I have a responsive website. For Mobile, On some posts, it shows adsense, some it doesnt. I understand that if it shows blank box, means its error from adsense due to the size issue. But, for the most part, I dont see unit loaded at all. no blank space or anything. Should there be any issue in this? Thanks This topic was modified 5 years, 2 months ago by zvhipp. Hi, @zvhipp Apologies for the delay in responding to this. I am not sure what could be causing your issue, but I have one thing you could check: Do you have Cache Mobile set to ON in LiteSpeed Cache > Settings > Cache? If your site has a responsive design, you dont need to cache a separate mobile view. Set it to OFF and see if the problem persists. Let us know if that doesnt solve the problem! Thank you for your reply. I tried turning it off, but it didnt help much, I will keep playing with the settings and javascript. Some pages I noticed text/html cache was set for 31 days in .htaccess. I updated it with 0. One question I had was, I use wp_is_mobile to display little different things just for mobile visitors. This was the reason I had enabled separate mobile view even though I have a responsive website. If I turn it off, then due to caching based on the device the page was accessed from, It displayed mobile only part on the desktop too and did opposite on mobile too. Will wp_is_mobile be reliable with mobile cache enabled? Thanks. Hi, @zvhipp It looks you have a browser cache directive in .htaccess interfering with LiteSpeed Cache. Change the line as follows: ExpiresByType text/html access plus 0 seconds That will stop the browser from caching your sites pages and leave the caching to LSCWP. That, plus the advice I gave earlier about turning off Cache Mobile, should fix the problem. If not, let me know! BTW, that .htaccess directive was probably added by another cache plugin. If you are currently running two cache plugins at once, it is a good idea to disable the other one, as it may be causing unpredictable behavior. As far as wp_is_mobile, I am afraid I dont know the answer to that question. @hailite, can you help? Reason: Fixed formatting Hi @lclarke @hailite, We are having this wp_is_mobile issue with LSCache aswell. I have also tried with ExpiresByType text/html access plus 0 seconds And also with Turning ON/OFF Separate Mobile Cache. Every time the headers send hit inside x-litespeed-cache along with the website, Desktop version loads on Mobile instead of Mobile number. Mobile Cache is either not being stored, or never loads. Everytime LSCache is hit, Only Desktop version is loaded. We are using OpenLitespeed, Ive also created a report ? QWQLMHUC. Hi, @basezap LSCache should work with wp_is_mobile, and you should have Cache Mobile set to ON. If you are able to create template files, you can test it easily. Create test.php in your themes directory and place this in the file:



LiteCache Rush: Speed comes from using less, not from doing it faster



Reference