[wp-trac] Re: [WordPress Trac] #8731: Taxonomies set
$post_status_join = true seems unnecessarily
WordPress Trac
wp-trac at lists.automattic.com
Mon May 18 04:13:35 GMT 2009
#8731: Taxonomies set $post_status_join = true seems unnecessarily
--------------------------+-------------------------------------------------
Reporter: bkrausz | Owner: ryan
Type: defect (bug) | Status: new
Priority: normal | Milestone: 2.8
Component: Taxonomy | Version: 2.7
Severity: major | Keywords: has-patch
--------------------------+-------------------------------------------------
Changes (by gortsleigh):
* cc: gortsleigh (added)
* keywords: needs-patch => has-patch
* severity: normal => major
* milestone: Future Release => 2.8
Comment:
I have an issue with this join that is not just an annoyance; it is
returning incorrect results.
My WP application has registered several custom taxonomies (for example,
'artist'). There are a number of posts generated via an import filter;
each post has an artist associated using a call like:
{{{
wp_set_object_terms($newid, $artist_slug, 'artist', false);
}}}
When I make a query for the posts associated with a specific artist,
WordPress returns no results (I guess because there are not multiple
revisions of the matching posts?). If I force the value of
$post_status_join to false, the correct posts are returned. This seems to
me a serious bug.
It also seems unnecessary as there does not seem to be any special need to
return revision data for a taxonomy query as opposed to a query with any
other criteria. I would think that most programmers would expect taxonomy
queries to return published posts, just the same as a category or tag
search would do.
I have attached a file with relevant wp_posts rows from my WP DB, along
with the SQL that WP generated from a query of the form "/index.php?artist
=son-volt"
I hope you will reconsider this for 2.8
I propose the patch be as follows:
{{{
ndex: wp-includes/query.php
===================================================================
--- wp-includes/query.php (revision 11373)
+++ wp-includes/query.php (working copy)
@@ -1958,7 +1958,6 @@
$whichcat .= " AND $wpdb->posts.ID
IN (" . implode(', ', $post_ids) . ") ";
$post_type = 'any';
$q['post_status'] = 'publish';
- $post_status_join = true;
} else {
$whichcat = " AND 0 ";
}
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/8731#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list