Skip to content

Commit 785b98a

Browse files
committed
- update resolver for relationship to filter out non-id values (this means that the relationship fields will not resolve properly for archive urls or other non post-object values
1 parent e2c8a30 commit 785b98a

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Changelog
22

3+
## 2.0.0-beta.6.0.0
4+
5+
### New Features
6+
7+
- [#114](https://github.com/wp-graphql/wpgraphql-acf/pull/114): feat: add pre filter for resolve type
8+
9+
### Chores / Bugfixes
10+
11+
- [#111](https://github.com/wp-graphql/wpgraphql-acf/pull/111): fix: oembed field type returns embed instead of URL entered to the field
12+
- [#112](https://github.com/wp-graphql/wpgraphql-acf/pull/112): fix: field groups on page templates not resolving
13+
- [#116](https://github.com/wp-graphql/wpgraphql-acf/pull/116): fix: error when querying `post_object`, `relationship` or `page_link` field nested on a `repeater` or `flexible_content` field
14+
- [#122](https://github.com/wp-graphql/wpgraphql-acf/pull/122): ci: update tests to run against WordPress 6.4
15+
316
## 2.0.0-beta.5.1.0
417

518
### Chores / Bugfixes

src/FieldType/Relationship.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,22 @@ public static function get_graphql_type( FieldConfig $field_config, AcfGraphQLFi
6363
$ids = $value;
6464
}
6565

66-
$ids = array_map(
66+
$ids = array_filter( array_map(
6767
static function ( $id ) {
6868
if ( is_object( $id ) && isset( $id->ID ) ) {
6969
$id = $id->ID;
7070
}
71-
return absint( $id );
71+
// filter out values that are not IDs
72+
// this means that external urls or urls to things like
73+
// archive links will not resolve.
74+
return absint( $id ) ?: null;
7275
},
7376
$ids
74-
);
77+
) );
7578

7679
$resolver = new PostObjectConnectionResolver( $root, $args, $context, $info, 'any' );
7780

81+
7882
if ( $is_one_to_one ) {
7983
$resolver = $resolver->one_to_one();
8084
}

wp-graphql-acf.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Description: Re-imagining the WPGraphQL for ACF plugin
55
* Author: WPGraphQL, Jason Bahl
66
* Author URI: https://www.wpgraphql.com
7-
* Version: 2.0.0-beta.5.1.0
7+
* Version: 2.0.0-beta.6.0.0
88
* Text Domain: wp-graphql-acf
99
* Requires PHP: 7.3
1010
* Requires at least: 5.9
@@ -29,7 +29,7 @@
2929
}
3030

3131
if ( ! defined( 'WPGRAPHQL_FOR_ACF_VERSION' ) ) {
32-
define( 'WPGRAPHQL_FOR_ACF_VERSION', '2.0.0-beta.5.1.0' );
32+
define( 'WPGRAPHQL_FOR_ACF_VERSION', '2.0.0-beta.6.0.0' );
3333
}
3434

3535
if ( ! defined( 'WPGRAPHQL_FOR_ACF_VERSION_WPGRAPHQL_REQUIRED_MIN_VERSION' ) ) {

0 commit comments

Comments
 (0)