The biggest thing this does is add a statuses_toward_count option to the Post::register_taxonomy() method, which takes a list of statuses (a flat array of strings) and ensures that posts within the given statuses are included in the term count, i.e. that terms that contain posts in such statuses are not considered "empty" even if they lack published posts.
This also moves the register_taxonomy() method from Post to the HasTerms trait. The trait is already included in Post, so this is not a breaking change.
Finally, it fixes a bug in the get_all_grouped_by_term() method to correctly determine whether a term should show up in the results, based on the term's post query (rather than the cached/denormalized term count, which may or may not reflect the actual number of queried posts).
TODO
[x] add high-level API for honoring custom statuses
Addresses #115
The biggest thing this does is add a
statuses_toward_count
option to thePost::register_taxonomy()
method, which takes a list of statuses (a flat array of strings) and ensures that posts within the given statuses are included in the term count, i.e. that terms that contain posts in such statuses are not considered "empty" even if they lack published posts.This also moves the
register_taxonomy()
method fromPost
to theHasTerms
trait. The trait is already included inPost
, so this is not a breaking change.Finally, it fixes a bug in the
get_all_grouped_by_term()
method to correctly determine whether a term should show up in the results, based on the term's post query (rather than the cached/denormalized termcount
, which may or may not reflect the actual number of queried posts).TODO
register_taxonomy()
methodget_all_grouped_by_term()
statuses_toward_count
option