Hello I am getting a Error of the Wordpress includes, this error appears when I post the multiple values of a taxonomy to index.php
<form role="search" method="post" id="searchform" action="<?php echo home_url( '/' ); ?>">
<select name="books[]" multiple>
<option value="a">a</option>
<option value="b">b</option>
</select>
<input type="submit" id="searchsubmit" value="Search" />
</form>
Warning: strpos() expects parameter 1 to be string, array given in www.domain.com\wordpress\wp-includes\query.php on line 1718
Warning: preg_split() expects parameter 2 to be string, array given in www.domain.com\wordpress\wp-includes\query.php on line 1719
Warning: Invalid argument supplied for foreach() in www.domain.com\wordpress\wp-includes\query.php on line 1720
foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) {
if ( 'post_tag' == $taxonomy )
continue; // Handled further down in the $q['tag'] block
if ( $t->query_var && !empty( $q[$t->query_var] ) ) {
$tax_query_defaults = array(
'taxonomy' => $taxonomy,
'field' => 'slug',
);
if ( isset( $t->rewrite['hierarchical'] ) && $t->rewrite['hierarchical'] ) {
$q[$t->query_var] = wp_basename( $q[$t->query_var] );
}
$term = $q[$t->query_var];
if ( strpos($term, '+') !== false ) {
$terms = preg_split( '/[+]+/', $term );
foreach ( $terms as $term ) {
$tax_query[] = array_merge( $tax_query_defaults, array(
'terms' => array( $term )
) );
}
} else {
$tax_query[] = array_merge( $tax_query_defaults, array(
'terms' => preg_split( '/[,]+/', $term )
) );
}
}
}
The error does not appear when I post it to searchresults.php or when I use when I use a single value or a none taxonomy name;
<select name="books">
<select name="NoneTaxonomyName[]" multiple>
does someone know how to resolve this?
solved with; query_var => false
register_taxonomy('taxname', 'post_type', array('hierarchical' => true, 'label' => 'lable', 'query_var' => false, 'rewrite' => array('slug' => 'slug')));