Opened 12 years ago
Last modified 4 years ago
#22558 new defect (bug)
Attachment term counts feels/are inaccurate
Reported by: | ocean90 | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Media | Keywords: | 2nd-opinion needs-testing |
Focuses: | administration | Cc: |
Description (last modified by )
For posts:
- Assign a term to a post, save as draft. Term count returns 0.
- Publish the post. Term count returns 1.
- Change post status back to draft. Term count returns 0.
For attachments:
- Upload an image, assign a term. Term count returns 0.
- Create a new post and insert the image in a published post. Term count returns 0.
- Create a new post, use the insert media modal and upload an image. Then go the the media edit screen and assign a term to the image. Term count returns 1.
- Change the post status back to draft. Term count returns 1.
- Upload an image, assign a term, attach the attachment to a published post. Term count returns 0.
The default term update callback is _update_post_term_count
. The function includes a special case for attachments, that's the reason why we have the 1 in step 3.
IMO the term count for attachments shouldn't rely on the parent post status. We should just force _update_generic_term_count
.
Also noted here: comment:ticket:21391:41
Change History (12)
#2
in reply to:
↑ 1
@
12 years ago
Replying to nacin:
Does not sound like a regression, can someone confirm?
No, not a regression. But more prominent now, since the UI is there.
#3
@
12 years ago
I can confirm that all those steps are accurate.
By way of a use-case scenario:
If you're using the new Attachment Post UI, to create an asset management tool with a custom taxonomy as the organizing mechanism, all attachments without post parents (unattached) will be correctly added to the selected terms. however, if you run a query using get_categories() you must set 'hide_empty' to false in order to show the attachments, which of course, means they're not registering in the 'count' column in term_taxonomy.
#6
@
11 years ago
+1 to force _update_generic_term_count, unless there's a really compelling reason that we want to favour attachments actually attached to posts.
Easy fix though when registering the taxonomy. Will update Codex in the meantime.
#11
@
5 years ago
- Focuses administration added
Bump. I'm kind of amazed that this bug has been outstanding for so long...
Does not sound like a regression, can someone confirm?