-
Notifications
You must be signed in to change notification settings - Fork 441
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
Add post type / taxonomy args for defining the GraphQL model #2466
Comments
BuddyPress actually does not use custom post types or taxonomies. So our custom loaders are necessary. |
Thanks for clarifying. Not sure why I thought |
No problem. I do like the idea though. Whatever we can do to make it easier, the better. But it needs to be flexible enough that one can hook into it, via callbacks or hooks. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
What problem does this address?
There are numerous cases where a custom post type / taxonomy needs to use a custom model. Currently implementing a custom model is a complicated and imperfect process, as the model is usually hard-coded into the data loader and connection resolver. This requires devs to extend/replace those classes in addition to all the
resolve
callbacks that use them.What is your proposed solution?
Continuing the work done in #2399 , a custom property should be added to
WP_Post_Type
andWP_Taxonomy
that allows a user to set a custom model.This model should then be used by the various DataLoader/ConnectionResolvers, falling back to the defaults when none is set.
What alternatives have you considered?
No response
Additional Context
nav_menu
(taxonomy) andnav_menu_items
(post_type).Model
instantiation in core. This is premised on my own experience, as well as browsing the source code of WooGraphQLand WPGraphQL for BP. @kidunot89 , @renatonascalves if I'm missing a use case, please chime in 🙏The text was updated successfully, but these errors were encountered: