[wp-trac] Re: [WordPress Trac] #5317: get_posts returns invalid data when using category= parameter

WordPress Trac wp-trac at lists.automattic.com
Tue Nov 13 14:55:57 GMT 2007


#5317: get_posts returns invalid data when using category= parameter
----------------------+-----------------------------------------------------
 Reporter:  MichaelH  |        Owner:  anonymous
     Type:  defect    |       Status:  new      
 Priority:  normal    |    Milestone:  2.4      
Component:  General   |      Version:  2.3.1    
 Severity:  normal    |   Resolution:           
 Keywords:            |  
----------------------+-----------------------------------------------------
Comment (by Kafkaesqui):

 Line #257 in post.php:

 `$query .= empty( $category ) ? '' :`
 `AND ($wpdb->posts.ID = $wpdb->term_relationships.object_id `
 `AND $wpdb->term_relationships.term_taxonomy_id =
 $wpdb->term_taxonomy.term_taxonomy_id `
 `AND $wpdb->term_taxonomy.term_id = " . $category. ") ";`

 This should be:

 `$query .= empty( $category ) ? '' : `
 `"AND ($wpdb->posts.ID = $wpdb->term_relationships.object_id `
 `AND $wpdb->term_relationships.term_taxonomy_id =
 $wpdb->term_taxonomy.term_taxonomy_id `
 `AND $wpdb->term_taxonomy.term_id = " . $category. " `
 `AND $wpdb->term_taxonomy.taxonomy = 'category') ";`

-- 
Ticket URL: <http://trac.wordpress.org/ticket/5317#comment:1>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list