#13670 closed defect (bug) (fixed)
Taxonomies for custom Post_Types do not recieve pad_counts treatment
| Reported by: | dd32 | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.0 |
| Component: | Taxonomy | Version: | 3.0 |
| Severity: | normal | Keywords: | needs-patch |
| Cc: | Focuses: |
Description
as reported by reko in #wordpress-dev, Taxonomy pad_counts do not apply to custom taxonomies, attached to custom post types.
Right now, the SQL limits pad_counts to published posts.
For comparison, The _update_post_term_count() function (which updates categories and tags counts) limits to published post_type objects in that taxonomy.
Change History (4)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
With this patch, _pad_term_counts() queries the post_type(s) of passed taxonomy instead of just post_type = 'post'.
REPLACED
wp-includes\taxonomy.php # 2387 with:
$object_types = is_array(get_taxonomy($taxonomy)->object_type) ? get_taxonomy($taxonomy)->object_type : array(get_taxonomy($taxonomy)->object_type);
$object_types = esc_sql($object_types);
$results = $wpdb->get_results("SELECT object_id, term_taxonomy_id FROM $wpdb->term_relationships INNER JOIN $wpdb->posts ON object_id = ID WHERE term_taxonomy_id IN (".join(',', array_keys($term_ids)).") AND post_type IN ('" . implode("', '", $object_types) . "') AND post_status = 'publish'");