Opened 6 years ago
Last modified 6 years ago
#50046 new defect (bug)
lack table selector in `_update_post_term_count`
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | 5.4 |
| Component: | Taxonomy | Keywords: | |
| Focuses: | Cc: |
Description
The function _update_post_term_count in wp-includes/taxonomy.php query the db without table selector.
<?php $count += (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type IN ('" . implode( "', '", $object_types ) . "') AND term_taxonomy_id = %d", $term ) );
This cause problem if who added a column named post_type in the $wpdb->term_relationships table, because the table $wpdb->posts has a column called post_type too.
Please quantify the column with the table name like $wpdb->posts.post_type.
Note: See
TracTickets for help on using
tickets.