#4251 closed defect (bug) (fixed)
Small error in get_posts not?
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 2.3 | Priority: | normal |
Severity: | normal | Version: | 2.2 |
Component: | General | Keywords: | |
Focuses: | Cc: |
Attachments (1)
Change History (8)
#2
@
18 years ago
- Milestone 2.2 deleted
- Resolution set to invalid
- Status changed from new to closed
No, it means that no two fields can be the same (distinct fields). Try it in phpMyAdmin. It works.
#3
@
18 years ago
- Resolution invalid deleted
- Status changed from closed to reopened
Not a SQL problem... just double $query ...
$query ="SELECT DISTINCT * FROM $wpdb->posts " ; $query .= ( empty( $category ) ? "" : ", $wpdb->post2cat " ); $query .= ( empty( $meta_key ) ? "" : ", $wpdb->postmeta " ); $query .= " WHERE (post_type = 'post' AND post_status = 'publish') $exclusions $inclusions "; $query .= ( empty( $category ) ? "" : "AND ($wpdb->posts.ID = $wpdb->post2cat.post_id AND $wpdb->post2cat.category_id = " . $category. ") " ); $query .= ( empty( $meta_key ) | empty($meta_value) ? "" : " AND ($wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = '$meta_key' AND $wpdb->postmeta.meta_value = '$meta_value' )" ); $query .= " GROUP BY $wpdb->posts.ID ORDER BY " . $orderby . " " . $order . " LIMIT " . $offset . ',' . $numberposts; $query = "SELECT DISTINCT * FROM $wpdb->posts "; $query .= empty( $category ) ? '' : ", $wpdb->post2cat "; $query .= empty( $meta_key ) ? '' : ", $wpdb->postmeta "; $query .= " WHERE 1=1 "; $query .= empty( $post_type ) ? '' : "AND post_type = '$post_type' "; $query .= empty( $post_status ) ? '' : "AND post_status = '$post_status' "; $query .= "$exclusions $inclusions " ;
#4
@
18 years ago
- Milestone set to 2.4
- Owner changed from anonymous to rob1n
- Status changed from reopened to new
My misunderstanding. I'll look into this.
#5
@
18 years ago
- Milestone changed from 2.4 to 2.3
- Priority changed from high to normal
- Severity changed from minor to normal
- Status changed from new to assigned
Yep. Looks like a bad patch apply or maybe copy and paste. Confirmed affects 2.1, 2.2 and 2.3 (trunk). Patch attached. I'll commit this in a sec.
Note: See
TracTickets for help on using
tickets.
doubloon => double entry..