Custom taxonomy query giving wrong result (PHP ver dependancy?)
-
Hi.
I’m trying to query custom taxonomies for a custom post type. And I’m trying to make it an “OR” relation.
I’m making a music archive, where I want to list other discs from the same artist. Sometimes there are discs with 2 different artists, so I’d like to list the discs from these artists on the same list. So I made a query like :
$args = array ( 'post_type' => 'disc', 'tax_query' => array ( 'relation' => 'OR', array ( 'taxonomy' => 'disc_artist', 'field' => 'slug', 'terms' => $artistnames[0] ), array ( 'taxonomy' => 'disc_artist', 'field' => 'slug', 'terms' => $artistnames[1] ), )); $the_query = new WP_Query($args);
This works on my localhost (XAMPP), but when uploaded on my hosted website, it just doesn’t work. The result query is a list of 10 most recent custom posts, which have nothing to do with the terms I made query with. (I tried with different fields like term_id and name. Same result..)
So I’m guessing, if it has something to do with PHP versions or SQL versions? My hosted server is UTF-8 (PHP5.3, MySQL5.x), and my XAMPP has PHP5.5.15. (Sorry, I have no idea where to find the SQL version of XAMPP.)
If somebody knows how to make the right query on my website, I’ll be thankful for any kind of help.
- The topic ‘Custom taxonomy query giving wrong result (PHP ver dependancy?)’ is closed to new replies.