File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 99class Taxonomy {
1010
1111 /**
12+ * Register support for the "taxonomy" ACF field type
1213 */
1314 public static function register_field_type (): void {
1415 register_graphql_acf_field_type (
@@ -25,22 +26,29 @@ public static function register_field_type(): void {
2526 return null ;
2627 }
2728
29+ $ values = [];
2830 if ( ! is_array ( $ value ) ) {
29- $ value [] = $ value ;
31+ $ values [] = $ value ;
32+ } else {
33+ $ values = $ value ;
3034 }
3135
32- $ value = array_map (
36+ $ ids = array_map (
3337 static function ( $ id ) {
3438 return absint ( $ id );
3539 },
36- $ value
40+ $ values
3741 );
3842
43+ if ( empty ( $ ids ) ) {
44+ return null ;
45+ }
46+
3947 $ resolver = new TermObjectConnectionResolver ( $ root , $ args , $ context , $ info );
4048 return $ resolver
4149 // Set the query to include only the IDs passed in from the field
4250 // and orderby the ids
43- ->set_query_arg ( 'include ' , $ value )
51+ ->set_query_arg ( 'include ' , $ ids )
4452 ->set_query_arg ( 'orderby ' , 'include ' )
4553 ->get_connection ();
4654 },
You can’t perform that action at this time.
0 commit comments