Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #389 from wp-graphql/resolve-deprecation-warning
Browse files Browse the repository at this point in the history
fix: deprecation warning
  • Loading branch information
jasonbahl authored Jul 22, 2024
2 parents 8c6a185 + c226c1b commit a76b8ac
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# WPGraphQL for Advanced Custom Fields

----

🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨

This plugin has gone through a complete re-architecture and this repository will soon be archived.

We recommend you upgrade to the new WPGraphQL for ACF v2.0+ at your earliest convenience.

The new version contains breaking changes, so update with caution. Below are some resources to help:

- UPGRADE GUIDE: https://acf.wpgraphql.com/upgrade-guide
- NEW PLUGIN REPO: https://github.com/wp-graphql/wpgraphql-acf
- NEW PLUGIN ON WORDPRESS.ORG: https://wordpress.org/plugins/wpgraphql-acf
- NEW PLUGIN ON COMPOSER: https://packagist.org/packages/wp-graphql/wpgraphql-acf
- NEW PLUGIN ON WPPACKAGIST: https://wpackagist.org/search?q=wpgraphql-acf&type=any&search=

🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
----

WPGraphQL for Advanced Custom Fields automatically exposes your ACF fields to the WPGraphQL Schema.

- [Install and Activate](#install-and-activate)
Expand Down
6 changes: 3 additions & 3 deletions src/class-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ protected function register_graphql_field( string $type_name, string $field_name
'resolve' => function( $root, $args, $context, $info ) use ( $acf_field ) {
$value = $this->get_acf_field_value( $root, $acf_field );

return DataSource::resolve_post_object( (int) $value, $context );
return $context->get_loader( 'post' )->load_deferred( (int) $value );
},
];
break;
Expand Down Expand Up @@ -903,11 +903,11 @@ protected function register_graphql_field( string $type_name, string $field_name
*/
if ( ! empty( $value ) && is_array( $value ) ) {
foreach ( $value as $term ) {
$terms[] = DataSource::resolve_term_object( (int) $term, $context );
$terms[] = $context->get_loader( 'term' )->load_deferred( (int) $term );
}
return $terms;
} else {
return DataSource::resolve_term_object( (int) $value, $context );
return $context->get_loader( 'term' )->load_deferred( (int) $value );
}
},
];
Expand Down

0 comments on commit a76b8ac

Please sign in to comment.