[Plugin: Query Multiple Taxonomies] incorrect results (seems like using OR instead of AND)
-
hi,
the plugin description sounds exactly like what I’m looking for, but unfortunately it doesn’t seem to work in my case. based on two separate taxonomies I’m trying to get posts of a custom post_type.
my url:
?post_type=project&projectprogram=program1&projectstatus=status1
also tried with query_posts:query_posts( array( 'post_type' => 'project', 'projectprogram' => 'program1', 'projectstatus' => 'status1' ) );
in both cases the behaviour / filtering of the plugin doesn’t work correctly. it falsely also returns posts associated with only one of the taxonomies. it behaves as if the WHERE clause would be
WHERE projectprogram='program1' OR projectstatus='status1'
, but I’m looking for something that doesWHERE projectprogram='program1' AND projectstatus='status1'
.i’m using the more taxonomies plugin to register the custom taxonomies, but i’ve exported the code in order to set public to 1. this is the code i’m now using to register them:
add_filter('more_taxonomies_saved', 'more_taxonomies_saved_projectprogram'); function more_taxonomies_saved_projectprogram ($d) {$d['projectprogram'] = maybe_unserialize('a:15:{s:12:"hierarchical";s:1:"1";s:6:"public";s:1:"1";s:5:"label";s:0:"";s:14:"singular_label";s:0:"";s:4:"name";s:0:"";s:7:"show_ui";s:1:"1";s:7:"rewrite";s:1:"1";s:12:"rewrite_base";s:14:"projectprogram";s:13:"show_tagcloud";s:1:"0";s:14:"query_var_bool";s:1:"1";s:9:"query_var";s:14:"projectprogram";s:5:"index";s:15:"projectprogram";s:12:"ancestor_key";s:0:"";s:11:"object_type";a:1:{i:0;s:7:"project";}s:6:"labels";a:14:{s:4:"name";s:16:"projectprograms";s:13:"singular_name";s:15:"projectprogram";s:12:"search_items";s:6:"Search";s:13:"popular_items";s:7:"Popular";s:9:"all_items";s:3:"All";s:11:"parent_item";s:6:"Parent";s:17:"parent_item_colon";s:6:"Parent";s:9:"edit_item";s:4:"Edit";s:11:"update_item";s:6:"Update";s:12:"add_new_item";s:7:"Add New";s:13:"new_item_name";s:8:"New Name";s:26:"separate_items_with_commas";s:20:"Separate with commas";s:19:"add_or_remove_items";s:13:"Add or Remove";s:21:"choose_from_most_used";s:34:"Choose from the most commonly used";}}', true); return $d; }
add_filter('more_taxonomies_saved', 'more_taxonomies_saved_projectstatus'); function more_taxonomies_saved_projectstatus ($d) {$d['projectstatus'] = maybe_unserialize('a:15:{s:12:"hierarchical";s:1:"1";s:6:"public";s:1:"1";s:5:"label";s:0:"";s:14:"singular_label";s:0:"";s:4:"name";s:0:"";s:7:"show_ui";s:1:"1";s:7:"rewrite";s:1:"1";s:12:"rewrite_base";s:13:"projectstatus";s:13:"show_tagcloud";s:1:"0";s:14:"query_var_bool";s:1:"1";s:9:"query_var";s:13:"projectstatus";s:5:"index";s:13:"projectstatus";s:12:"ancestor_key";s:0:"";s:11:"object_type";a:1:{i:0;s:7:"project";}s:6:"labels";a:14:{s:4:"name";s:13:"projectstatus";s:13:"singular_name";s:13:"projectstatus";s:12:"search_items";s:13:"Search status";s:13:"popular_items";s:14:"Popular status";s:9:"all_items";s:10:"All status";s:11:"parent_item";s:13:"Parent status";s:17:"parent_item_colon";s:13:"Parent status";s:9:"edit_item";s:11:"Edit status";s:11:"update_item";s:13:"Update status";s:12:"add_new_item";s:14:"Add new status";s:13:"new_item_name";s:15:"New status name";s:26:"separate_items_with_commas";s:27:"Separate status with commas";s:19:"add_or_remove_items";s:20:"Add or remove status";s:21:"choose_from_most_used";s:41:"Choose from the most commonly used status";}}', true); return $d; }
Any clue what’s going wrong here?
Thanks and best,
Brogr
- The topic ‘[Plugin: Query Multiple Taxonomies] incorrect results (seems like using OR instead of AND)’ is closed to new replies.