Cache doesn’t work correctly, but only on mobile?

[ad_1]

Hey, I have a custom code that turns my post dates into “minutes ago” instead of “4.14.2024”. It works completely fine, it’s in my functions.php, I could add it if anyone is interested.

\- When I enable cache plugins, the time function goes weird but only on mobile. It doesn’t show the latest posts, and it says “20 minutes ago” instead of “40 minutes ago” like on the desktop (the correct version).

\- I’ve tried WP Rocket, W3, WP Optimize, and enabled/disabled mobile only caching. At least when I disable “mobile only” the latest posts appear.

Any tips would be greatly appreciated. Basically on desktop it all seems to work fine and correctly (correct time + cache), but on mobile the time of each post literally changes when I’m looking at it on the homepage -> when I click on it.

Thank you!

[ad_2]
1 Comment
  1. Is the “minutes ago” code JS or PHP? It is the latter it won’t work, because its value will be cached. It has to be JS that runs in the client.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer