Opened 2 years ago
Closed 2 years ago
#17220 closed defect (bug) (fixed)
get_posts_by_author_sql() should use the post type object
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.2 |
| Component: | Post Types | Version: | |
| Severity: | normal | Keywords: | has-patch commit |
| Cc: |
Description
The filter there, pub_priv_sql_capability, is pretty useless, particularly since it doesn't receive any context. Suggesting we simply remove it.
Patch also adds a $post_type property to count_many_users_posts().
Attachments (2)
Change History (7)
- Keywords commit added
Tested with a custom column and using count_many_users_posts() with a custom post type.
Alternative for keeping the filter should be this:
if ( ! $cap = apply_filters( 'pub_priv_sql_capability', '' ) )
$cap = $post_type_obj->cap->read_private_posts;
Rather than applying the filter over read_private_posts, given its historical usage.
Either way, we should also remove the various comments about pub_priv_sql_capability() in the phpdoc for get_private_posts_cap_sql(), which is where the filter was introduced in r5189.
- Resolution set to fixed
- Status changed from new to closed
Note: See
TracTickets for help on using
tickets.

Untested.