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
Assuming that post 5 has a top term set, the top term returned will be that set on post 5.
If no top term is set on post 5, largo_top_term() calls largo_category_and_tags() to get a list of categories and tags. That function doesn't use post 5, but instead fetches terms from the get_the_ID() post, which in many situations (like the homepage) is not the post that we want terms for.
There are two situations to consider:
On a largo_top_term() call with a specificied post that does not match the global post ID. In this situation, we should not call largo_category_and_tags(), because its output will be wrong.
On a largo_top_term() call with no post specified, largo_top_term() will get the post ID to use from get_the_ID() the same as largo_category_and_tags(). This use case includes the top term on single posts.
We can't remove largo_category_and_tags() from largo_top_term() as a fallback, yet, but we should not also go around outputting incorrect terms. Until largo_category_and_tags() is refactored to make it easier to specify the post ID, we can check in largo_top_term() for a mismatch between the specified post ID and the global post ID, and not call largo_category_and_tags() in that situation.
…tags(), and a fix for #1647 by not calling largo_category_and_tags() when the post given to largo_top_term() does not match the post returned by get_the_ID()
Consider the following code:
Assuming that post 5 has a top term set, the top term returned will be that set on post 5.
If no top term is set on post 5,
largo_top_term()
callslargo_category_and_tags()
to get a list of categories and tags. That function doesn't use post 5, but instead fetches terms from theget_the_ID()
post, which in many situations (like the homepage) is not the post that we want terms for.There are two situations to consider:
largo_category_and_tags()
, because its output will be wrong.largo_top_term()
will get the post ID to use fromget_the_ID()
the same aslargo_category_and_tags()
. This use case includes the top term on single posts.Identified during work on #1646
The text was updated successfully, but these errors were encountered: