Hello, I have the listing component in the main page which shows new added listings by date, but I notice that class-listings-php file loads the listings in cache and not the real time new listings.
I have comment the following code in order to work better:
If you mean the UI block settings, we recommend leaving the cache, because the cache is updated only after the listing is updated or a new listing is created, in all other options the cache is not updated. If this does not work correctly for you, try re-saving the listing. Also, if the last recommendation did not help, I recommend disabling all third-party plugins and caching, or contacting your hosting provider, as there may be caching on their side.
Following your recommendations, I have identified the problem. The issue was caused by a snippet of code that updates the listing date upon user request.
I resolved the problem by clearing the cache after updating the dates with the following code in the snippet:
By this way I leave the class-listings.php file without any modification.
Do you think this is a good solution? I have tried to use delete_post_cache in order to clear only the affected listing, but I don’t have found enough documentation to understand the functions parameters. I have only the listing id and this call doesn’t work:
Please note that the listing cache is cleared after the listing is updated or created. It all depends on where exactly you added this delete_cache; if it is an infrequent action, then there shouldn’t be an issue.