Skip to content
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

Open
justlevine opened this issue Aug 4, 2022 · 4 comments
Open

Add post type / taxonomy args for defining the GraphQL model #2466

justlevine opened this issue Aug 4, 2022 · 4 comments
Labels
scope: API Issues related to access functions, actions, and filters Status: Discussion Requires a discussion to proceed Type: Enhancement New feature or request

Comments

@justlevine
Copy link
Collaborator

justlevine commented Aug 4, 2022

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 and WP_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

@justlevine justlevine added Type: Enhancement New feature or request scope: API Issues related to access functions, actions, and filters labels Aug 4, 2022
@renatonascalves
Copy link
Collaborator

renatonascalves commented Aug 5, 2022

This is premised on my own experience, as well as browsing the source code...

BuddyPress actually does not use custom post types or taxonomies. So our custom loaders are necessary.

@justlevine
Copy link
Collaborator Author

BuddyPress actually does not use custom post types or taxonomies.

Thanks for clarifying. Not sure why I thought Groups was a custom tax 😅

@renatonascalves
Copy link
Collaborator

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.

@stale
Copy link

stale bot commented Nov 3, 2022

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.

@stale stale bot added the Stale? May need to be revalidated due to prolonged inactivity label Nov 3, 2022
@justlevine justlevine added Status: Discussion Requires a discussion to proceed and removed Stale? May need to be revalidated due to prolonged inactivity labels Nov 3, 2022
@jasonbahl jasonbahl added the not stale Short-circuits stalebot. USE SPARINGLY label Dec 16, 2022
@justlevine justlevine removed the not stale Short-circuits stalebot. USE SPARINGLY label Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: API Issues related to access functions, actions, and filters Status: Discussion Requires a discussion to proceed Type: Enhancement New feature or request
Projects
Status: 💬 In Discussion
Development

No branches or pull requests

3 participants