您好,我收到 Wordpress 包含的错误,当我将分类的多个值发布到 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>
警告:strpos() 期望参数 1 是字符串,数组在www.domain.com\wordpress\wp-includes\query.php的第1718行给出
警告:preg_split() 期望参数 2 是字符串,数组在 www.domain.com\wordpress\wp-includes\query.php 中给出。第1719行的 domain.com\wordpress\wp-includes\query.php
警告:在第1720行为 www.domain.com\wordpress\wp-includes\query.php中的 foreach() 提供的参数无效
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 )
) );
}
}
}
当我将它发布到 searchresults.php 或当我使用单个值或无分类名称时,该错误不会出现;
<select name="books">
<select name="NoneTaxonomyName[]" multiple>
有人知道如何解决这个问题吗?