-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create helper functions for extending queries and mutations #246
Comments
@CodeProKid ya, I'd love to see what ideas you have. I think this would definitely be a good thing to have some nice Off the top of my head, here are some that I can think of that might be good: register_graphql_field This would allow someone to add a field to any type in the Schema. Might look like Where
register_graphql_type This one I think needs a little more thought. . .because there are different Types that can be registered, so not sure if we want a different function for each, like register_graphql_mutation_field / register_graphql_mutation_type? Not sure what this would look like, but might be helpful. . . graphql_wrap_resolver( $fieldName, $type, $callback ) Not sure exactly how this should look, but I think it would be good to have some function like this that allows folks to add granular control over specific fields. . . For example, if I wanted to hide just
we could even potentially have other pre-made ones, like:
|
Would it be possible to add my CPTs and their custom fields to the Schema and then run a query like below?
I'm using ACF but I've registered all my custom post types and the custom fields for each CPT via PHP instead of the ACF UI. All my CPTs are linked to each other via bidirectional relationships. |
Hey @cr101 I’m afk but will get you more details when I get to a computer. You can search closed issues though and you should be able to find info on registering custom post types and adding fields to the types in your schema. |
Hi @jasonbahl
I'd love to see an example, thank you. I had a look on the Wiki but I couldn't find any examples. |
closing this and tracking on #327 |
I think it would be good to have some helper functions that make it easier for developers to extend WPGraphQL. Something similar to
register_rest_route()
. This would help lower the barrier to entry for the community, and would also provide developers with a consistent way to extend the plugin, which would make backwards compatibility easier for us down the line.This is just a stubbed issue, I have some more in depth ideas for this that I'll share when I get a moment, open to feedback from anyone else as well though.
The text was updated successfully, but these errors were encountered: