Closed mboynes closed 7 years ago
Looks like it's decrementing by 2 when terms are removed from a post. I'll add a test for this and get that bug resolved.
@david-binda @mattoperry I had some momentum so I ran with this. Give it a review and if it looks good to you, I have a site I can test it on.
One important point, I bumped the minimum WP version to 4.7 due to a change to the added_term_relationship
and deleted_term_relationships
actions that went in in 4.7 (the $taxonomy
param was added). Working around this is a moderate amount of work to support down to 4.3, and it would be very difficult to support < 4.3 (due to changes in get_term_by()
introduced in 4.3 that we'd need to account for not having the taxonomy). My opinion is to keep it 4.7+ to keep the code as simple as possible, but if either of you feel strongly otherwise, please let me know.
Plugin updated with numerous improvements. We have a failing test that I think I might change -- in short, if an unattached attachment (an attachment with post_parent == 0), the plugin counts it because the attachment is technically considered public. However, core doesn't correctly calculate this right now. Counting it, therefore, sidesteps a core bug (See #23530, #22558).
Gah, I'm fixing the PHPCS issues.