fix:$post_type must be an array when passed to in_array() (#695)

* * `$post_type` must be an array when passed to `in_array()`.
* Removes unused `$post_type_obj` variable.

* * Fixes tabs.
This commit is contained in:
Gilles
2023-01-23 15:48:09 -05:00
committed by GitHub
parent 23c7f30347
commit e772b2387e
+1 -1
View File
@@ -543,6 +543,7 @@ class Products {
* @return array Query arguments.
*/
public static function map_input_fields_to_wp_query( $query_args, $args, $source, $all_args, $context, $info, $post_type ) {
$post_type = is_array( $post_type ) ? $post_type : array( $post_type );
if ( ! in_array( 'product', $post_type, true ) && ! in_array( 'product_variation', $post_type, true ) ) {
return $query_args;
}
@@ -689,7 +690,6 @@ class Products {
}//end if
// Handle visibility.
$post_type_obj = get_post_type_object( $post_type );
if ( ! empty( $where_args['visibility'] ) ) {
switch ( $where_args['visibility'] ) {
case 'search':