[wp-trac] [WordPress Trac] #12287: Bug with : Query Posts, Post status and Custom Taxonomy
WordPress Trac
wp-trac at lists.automattic.com
Fri Feb 19 15:30:11 UTC 2010
#12287: Bug with : Query Posts, Post status and Custom Taxonomy
---------------------------+------------------------------------------------
Reporter: momo360modena | Owner: ryan
Type: defect (bug) | Status: new
Priority: normal | Milestone: 3.0
Component: Query | Version:
Severity: normal | Keywords:
---------------------------+------------------------------------------------
I use a category for a events section of my website. I filter on two
criters, one custom taxonomy, and a default WordPress category.
The request :
query_posts(
'showposts=6&post_status=future&cat=7&taxonomy=departements&term=Gironde&order=ASC&orderby=date'
)
The SQL query :
SELECT SQL_CALC_FOUND_ROWS wp_posts.*
FROM wp_posts
LEFT JOIN wp_posts AS p2
ON (wp_posts.post_parent = p2.ID)
WHERE 1=1 AND wp_posts.ID NOT IN ( SELECT tr.object_id FROM
wp_term_relationships AS tr
INNER JOIN wp_term_taxonomy
AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
WHERE tt.taxonomy = 'category'
AND tt.term_id IN ('7') )
AND wp_posts.ID IN (765, ... ,796)
AND wp_posts.post_type != 'revision'
AND (
(wp_posts.post_status = 'publish')
OR
(wp_posts.post_status = 'inherit' AND (p2.post_status =
'publish'))
)
ORDER BY wp_posts.post_date DESC
LIMIT 0, 4
The result :
I obtain post with the status publish and no future.
The cause :
line 1937, query.php, on trunk.
$q['post_status'] = 'publish';
Why force post_status here ?
I precise that this request work without the custom taxonomy on
query_posts();
--
Ticket URL: <http://core.trac.wordpress.org/ticket/12287>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list