You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not a usage question (Those should be directed to the community supported forum, unless this is a question about Polylang Pro in which case you should use the helpdesk).
I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
The issue still exists against the latest master branch of Polylang and the latest WordPress version.
This bug happens with only Polylang plugin active
This bug happens with a default WordPress theme active
I can reproduce this bug consistently
Steps to reproduce the issue
Create an archive template file and use either get_lastpostmodified or get_lastpostdate to get and display the last post date.
Visit an archive page in one language (for example /fr/category/term)
Compare it with the same archive for another language (for example /en/category/term)
Expected behavior and actual behavior
When I follow those steps, I see both archive pages show the same last post date: the absolute last post date irrespective of the selected language.
I was expecting to see the last post date for the selected language OR hoping to find a dedicated function like pll_get_lastpostdate available in api.php
The text was updated successfully, but these errors were encountered:
Hum... After some investigations on the topic, I would say that we should take great care not to harm performance.
This ticket reports performance issues for the queries run by get_lastpostmodified() and get_lastpostdate(). Our own queries would be even slower as we would need to join the posts table to the term_relationships. and we would need to multiply the number of queries per the number of languages.
Additionnally the filter pre_get_lastpostmodified allows to bypass the WP queries for get_lastpostmodified() but we don't have an equivalent filter for get_lastpostdate(). That means that if we decide to filter these functions both WP queries and ours would run.
This comment is however quite interesting as it proposes an alternative solution for some use cases: Would it work for you to loop over the posts you queried in your archive template instead of firing an additional DB query to get the absolute last modified post? I guess it would be ok for page 1 but not if you want to display the date on page 2 and next.
Prerequisites
master
branch of Polylang and the latest WordPress version.Steps to reproduce the issue
get_lastpostmodified
orget_lastpostdate
to get and display the last post date.Expected behavior and actual behavior
When I follow those steps, I see both archive pages show the same last post date: the absolute last post date irrespective of the selected language.
I was expecting to see the last post date for the selected language OR hoping to find a dedicated function like
pll_get_lastpostdate
available in api.phpThe text was updated successfully, but these errors were encountered: