• Resolved kacper3355

    (@kacper3355)


    Hi.

    Is there any way to exclude post date from being cached by LiteSpeed Cache? Our post dates often get updated, and sometimes LSCache still shows the old version of the date, despite the post being updated. It is a huge problem for us and we have no idea how to fix this.

    For example, lets say the post has been published on Monday, June 1. Then 2 days later the post gets updated, and the date should change to Wednesday, June 3. Often it doesn’t happen, LS Cache still shows the old date, Monday, June 1 in this scenario.

    • This topic was modified 1 year, 10 months ago by kacper3355.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support qtwrk

    (@qtwrk)

    please provide the report number , you can get it in toolbox -> report -> click “send to LiteSpeed”

    Thread Starter kacper3355

    (@kacper3355)

    Hi @qtwrk,

    Report number: HXYAQWUG

    Plugin Support qtwrk

    (@qtwrk)

    try this

    1. open the post you want to edit, as guest user , check the http response header, make sure you see x-litespeed-cache: hit
    2. do your edit on this post, save it
    3. refresh the page in step 1, check what is the value of x-litespeed-cache header afterwards.
    Thread Starter kacper3355

    (@kacper3355)

    Hi @qtwrk

    Here are the results: https://i.imgur.com/Qu0ZVIA.jpg

    Please note that the issue is not present every time. Most often it happens after midnight, when “Today” in date meta should change to “Yesterday”, but it doesn’t.

    Plugin Support qtwrk

    (@qtwrk)

    oh , I see, if the date is generated by PHP , and when page is cached, no PHP is involved, it will stick to whatever it was generated last time

    only possible solution is to schedule a purge all every day at midnight 00:01

    Thread Starter kacper3355

    (@kacper3355)

    @qtwrk

    The solution is not perfect. What would you suggest instead? I mean, should we rewrite how the date is generated? If the answer is yes, should it be generated by JS or something else? If it was JS, would it be possible to exclude it from caching?

    Plugin Support qtwrk

    (@qtwrk)

    well , yeah , it’s not perfect, but unfortunately , that’s probably the only viable solution

    it’s more like your theme thing as how it decides to output that date info

    yes you can use JS to modify , but if your theme doesn’t have such feature , then there is nothing to exclude

    like if your theme’s PHP code directly output today or yesterday …etc , then that’s it

    unless the theme generates it as timestamp , then use JavaScript to “translate” into date time , but that will need to be added by theme

    Thread Starter kacper3355

    (@kacper3355)

    @qtwrk

    It’s not a problem to rewrite the date, we have our own developer. I just wanted to ask how it should be done properly so there’s no conflict with LiteSpeed Cache. I’d appreciate the instruction, since you know the plugin best ??

    Plugin Support qtwrk

    (@qtwrk)

    I would imagine case like this

    the PHP outputs somthing like 2023-05-26 , or even unix epoch time , then use javascript to check local time against the post time, then convert it to something like today , yesterday …etc

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘LiteSpeed Cache caches post date which is not changing when updated’ is closed to new replies.