您可以为自定义字段使用自定义插件
function fb_custom_search_where($where) {
// put the custom fields into an array
$customs = array(\'custom_field1\', \'custom_field2\', \'custom_field3\');
foreach( $customs as $custom ) {
$query .= " OR (";
$query .= "( m.meta_key = \'$custom\' )";
$query .= " AND ( m.meta_value LIKE \'{$n}{$term}{$n}\' )";
$query .= ")";
}
$where = " AND ({$query}) AND ($wpdb->posts.post_status = \'publish\') ";
return($where);
}
add_filter( \'posts_where\', \'fb_custom_search_where\' );
您还可以检查插件
WP Custom Fields Search 你有一个临时解决方案。