Opened 15 years ago
Closed 15 years ago
#15797 closed defect (bug) (fixed)
calling query_posts with category_not_in doesn't affect the query
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 3.1 | Priority: | high |
| Severity: | blocker | Version: | 3.1 |
| Component: | Taxonomy | Keywords: | |
| Focuses: | Cc: |
Description
Example NOT IN:
function doit_category__not_in() {
$results = query_posts( array( 'category__not_in' => array ( '1' ) ) );
}
add_action('admin_init', 'doit_category__not_in');
Queries:
# SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'future' OR wp_posts.post_status = 'draft' OR wp_posts.post_status = 'pending' OR wp_posts.post_status = 'private') ORDER BY wp_posts.post_date DESC LIMIT 0, 10
require_once, do_action, call_user_func_array, doit_category__not_in, query_posts, WP_Query->query, WP_Query->get_posts #10 (46.5ms)
# SELECT FOUND_ROWS()
require_once, do_action, call_user_func_array, doit_category__not_in, query_posts, WP_Query->query, WP_Query->get_posts #11 (0.2ms)
# SELECT t.*, tt.*, tr.object_id FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category', 'post_tag', 'post_format') AND tr.object_id IN (225, 224, 223, 222, 221, 220, 219, 218, 217, 207) ORDER BY t.name ASC
require_once, do_action, call_user_func_array, doit_category__not_in, query_posts, WP_Query->query, WP_Query->get_posts, update_post_caches, update_object_term_cache, wp_get_object_terms #12 (33.0ms)
# SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (225,224,223,222,221,220,219,218,217,207)
require_once, do_action, call_user_func_array, doit_category__not_in, query_posts, WP_Query->query, WP_Query->get_posts, update_post_caches, update_postmeta_cache, update_meta_cache #13 (14.1ms)
Example IN:
function doit_category__in() {
$results = query_posts( array( 'category__in' => array ( '1' ) ) );
}
add_action('admin_init', 'doit_category__in');
Queries:
# SELECT term_taxonomy_id FROM wp_term_taxonomy WHERE taxonomy = 'category' AND term_id IN (1) require_once, do_action, call_user_func_array, doit_category__in, query_posts, WP_Query->query, WP_Query->get_posts, WP_Tax_Query->get_sql, WP_Tax_Query->_transform_terms #14 (0.4ms) # SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (1) ) AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'future' OR wp_posts.post_status = 'draft' OR wp_posts.post_status = 'pending' OR wp_posts.post_status = 'private') GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10 require_once, do_action, call_user_func_array, doit_category__in, query_posts, WP_Query->query, WP_Query->get_posts #15 (6.6ms) # SELECT FOUND_ROWS() require_once, do_action, call_user_func_array, doit_category__in, query_posts, WP_Query->query, WP_Query->get_posts
Change History (2)
Note: See
TracTickets for help on using
tickets.
[16893]