Skip to content

Commit 968b0aa

Browse files
committed
- fix a bug with Taxonomy field erroring when resolving if only one item is selected instead of multiple items
1 parent 0eb0db5 commit 968b0aa

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/FieldType/Taxonomy.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,16 @@ public static function register_field_type(): void {
2626
return null;
2727
}
2828

29+
$values = [];
2930
if ( ! is_array( $value ) ) {
30-
$value[] = $value;
31+
$values[] = $value;
3132
}
3233

3334
$value = array_map(
3435
static function ( $id ) {
3536
return absint( $id );
3637
},
37-
$value
38+
$values
3839
);
3940

4041
$resolver = new TermObjectConnectionResolver( $root, $args, $context, $info );

src/FieldType/User.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ public static function register_field_type(): void {
3939
return null;
4040
}
4141

42+
$values = [];
4243
if ( ! is_array( $value ) ) {
43-
$value = [ $value ];
44+
$values[] = $value;
4445
}
4546

4647
$value = array_map(
@@ -50,10 +51,9 @@ static function ( $user ) {
5051
}
5152
return absint( $user );
5253
},
53-
$value
54+
$values
5455
);
5556

56-
5757
$resolver = new UserConnectionResolver( $root, $args, $context, $info );
5858
return $resolver->set_query_arg( 'include', $value )->set_query_arg( 'orderby', 'include' )->get_connection();
5959
},

0 commit comments

Comments
 (0)