[wp-hackers] tags and categories combined not working: is it a
bug or a feature?
Otto
otto at ottodestruct.com
Wed Feb 13 16:23:56 GMT 2008
On Feb 13, 2008 10:12 AM, Burobjorn <burobjorn at gmail.com> wrote:
> And I get the results I would expect. When I want to get all posts in
> the category media-awarness (still using id 12) and just the tag
> 'elderly' I get the following SQL code and no results :
>
> SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts INNER JOIN
> wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)
> INNER JOIN wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id =
> wp_term_taxonomy.term_taxonomy_id) WHERE 1=1 AND
> wp_term_taxonomy.taxonomy = 'category' AND wp_term_taxonomy.term_id IN
> ('12') AND wp_term_taxonomy.taxonomy = 'post_tag' AND
> wp_term_taxonomy.term_id IN ('19') AND post_type IN('page', 'post') AND
> (post_status = 'publish' OR post_status = 'private') GROUP BY
> wp_posts.ID ORDER BY post_date DESC LIMIT 0, 10
>
> What the heck is going on?
Look closely at the WHERE clause:
WHERE 1=1 AND
wp_term_taxonomy.taxonomy = 'category' AND
wp_term_taxonomy.term_id IN ('12') AND
wp_term_taxonomy.taxonomy = 'post_tag' AND
wp_term_taxonomy.term_id IN ('19')
That's not possible. No taxonomy can both equal 'category' and 'post_tag'.
Trac ticket is here: http://trac.wordpress.org/ticket/5433
I attached a potential patch to that ticket. Have not tested it yet,
so don't know if it will work.
More information about the wp-hackers
mailing list