sitecrafting / conifer

:evergreen_tree: A powerful WordPress library plugin for OO development
https://www.coniferplug.in
MIT License
18 stars 2 forks source link

Honor custom statuses #116

Closed acobster closed 4 years ago

acobster commented 5 years ago

Addresses #115

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