WP_Query – Multiple Taxonomies warning
-
Hi guys! ??
I have problems with WP_Query for multiple taxonomies, array:
[tax_query] => Array ( [relation] => AND [0] => Array ( [taxonomy] => catalogue [field] => slug [include_children] => 1 [terms] => Array ( [0] => wina ) ) [1] => Array ( [taxonomy] => aoc [field] => slug [terms] => Array ( [0] => aoc-xxx [1] => aoc-yyy ) [operator] => IN ) [2] => Array ( [taxonomy] => manufacturer [field] => slug [terms] => Array ( [0] => ostrowin [1] => wojnar ) [operator] => IN ) )
Situation: I have multiple choice for AOC and Manufacturers. Everything seems fine, until parsing aoc terms. WP_Query has problems with this one.
Warning: preg_split() expects parameter 2 to be string, array given in /_hosting/_gd/_winamp/wp-includes/query.php on line 1726
Warning: preg_split() expects parameter 2 to be string, array given in /_hosting/_gd/_winamp/wp-includes/query.php on line 1726
Lines in WP_Query:
$tax_query[] = array_merge( $tax_query_defaults, array( 'terms' => preg_split( '/[,]+/', $term ) ) );
I really don’t know what is going on, manfuacturers are exacly the same taxonomy, and works fine. I must write code in strict mode. I cannot modify core, but it look like this solution works perfectly:
$tax_query[] = array_merge( $tax_query_defaults, array( 'terms' => $term //preg_split( '/[,]+/', $term ) ) );
- The topic ‘WP_Query – Multiple Taxonomies warning’ is closed to new replies.