#12287 closed defect (bug) (fixed)
Bug with : Query Posts, Post status and Custom Taxonomy
Reported by: | momo360modena | Owned by: | ryan |
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Query | Keywords: | |
Focuses: | Cc: |
Description
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.
$qpost_status? = 'publish';
Why force post_status here ?
I precise that this request work without the custom taxonomy on query_posts();
Attachments (2)
Change History (10)
#2
@
15 years ago
It was probably done to force evaluation of the post status block that comes later. I think we change that line to set the status to publish only if it is not already set.
#3
@
15 years ago
I add this line temporary:
if ( !isset($q['post_status']) || empty($q['post_status']) ) $q['post_status'] = 'publish';
#5
@
14 years ago
- Resolution set to duplicate
- Status changed from new to closed
Prefer this ticket : ticket:12856
#7
@
14 years ago
- Resolution set to fixed
- Status changed from reopened to closed
Bug fixed on changeset:14478
Argh... no edition. the same description with better format.
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 :
The SQL query :
The result :
I obtain post with the status publish and no future.
The cause :
line 1937, query.php, on trunk.
Why force post_status here ?
I precise that this request work without the custom taxonomy on query_posts();