[wp-trac] [WordPress Trac] #17019: add hooks for Media Library attachment counts
WordPress Trac
noreply at wordpress.org
Mon Mar 3 02:32:04 UTC 2014
#17019: add hooks for Media Library attachment counts
----------------------------------------+------------------
Reporter: kevinB | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 3.9
Component: Query | Version: 2.5
Severity: normal | Resolution:
Keywords: has-patch needs-unit-tests | Focuses:
----------------------------------------+------------------
Comment (by nacin):
Adding a "count" flag to WP_Query is a good step, but let's avoid doing
query_context in this ticket. That should be separate. Really, both of
these should be distinct, Query-specific tickets, as they're new API,
versus being buried in a "add hooks for Media Library attachment counts"
ticket.
This needs database considerations in terms of COUNT(*) versus COUNT(1)
versus COUNT(ID). pento probably knows which is best.
post_count is normally an integer so we should cast it here as well,
rather than after. I'd also use `new WP_Query( $args )` followed by
`$attachments = $query->post_count` so the return value is obvious.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/17019#comment:43>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list