-
Notifications
You must be signed in to change notification settings - Fork 440
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 Tax Query support to PostObject #1387
Conversation
Deploy request for wpgraphql-docs pending review. Review with commit ad0aca8 |
@seagyn I think we might need some way to make sure the tax query plugin doesn't cause errors by registering the same Types and Fields. 🤔 Like if WPGRAPHQL_VERSION is greater than x, do something to prevent execution of the tax query plugin 🤔 We can handle it to a degree with documentation, which we should for sure do as well, but some way to avoid the conflicts in code would be 👌 in my mind. |
@jasonbahl because we're pre 1.0 is it perhaps not worth allowing this to break? I went down the rabbit whole of doing this and my thought pattern ended with "When would we feasibly remove this check?". There have been much larger breaking changes in the codebase. If it's a hard requirement, we could possibly disable the plugin during the bootstrapping process. As soon as it initialises (the version with this code), it will check for the existence of the plugin and disable it? https://developer.wordpress.org/reference/functions/deactivate_plugins/ with this as a check: https://developer.wordpress.org/reference/functions/is_plugin_active/ Thoughts? |
OK great. I've added the tests. Let me know if this anything else I must do. Stuck on the coverage part and not sure if that's automated. |
@jasonbahl finally fixed all the tests 🙈 Do you want me to explore any improvements to this? |
Codecov Report
@@ Coverage Diff @@
## develop #1387 +/- ##
===========================================
- Coverage 62.36% 62.08% -0.28%
===========================================
Files 186 190 +4
Lines 10542 10656 +114
===========================================
+ Hits 6574 6616 +42
- Misses 3968 4040 +72
Continue to review full report at Codecov.
|
@seagyn @jasonbahl Anything missing here? |
@jasonbahl, bringing this to your attention since version 1.5.9 plugin wp-graphql-tax-query no longer works. |
@jasonbahl any word on this? I just came across the issue via: wp-graphql/wp-graphql-tax-query#27 Didn't want to lose the speed of 1.6+ so I wrote a patch for wp-graphql-tax that checks if type is registered first so I can register taxTypes that I needed along with mutations, etc. and still have the plugin do its work. Would rather have an official solution. thx. |
Is this now obsolete @seagyn ? |
@tomgreeEn I've had some discussion with some folks (specifically my colleague at WPEngine, @ToughCrab24) on better standardizing the filters for connections. We're hoping to have some progress in this area in the not too distant future, likely starting with some ideas posted in a new issue, then some iteration. The idea is to get to a point where the filters on connections are more standardized. We're looking at how other systems like Graph.Cool, Prisma, GraphCMS, SupaBase, Gatsby, etc handle their filters. Right now, there's severe limitations from the Schema design and usability of our "connection where args" design and we want to address that a bit more formally |
Understood thanks for the explanation! |
@dgaidula, how did you patch wp-graphql-tax-query ? Any chance you could share your diff? Or @jasonbahl is there a recommended way to run these kinds of queries while you formalize filters? Would really like to move off 1.5.9 |
What does this implement/fix? Explain your changes.
This implements the ability (previously in a plugin) to do a tax query on a post object. This is super useful for people which large sets of posts that need the ability to filter those down by taxonomy especially on sites that pull from WPGraphQL on runtime.
Does this close any currently open issues?
Closes #1384
Any relevant logs, error output, GraphiQL screenshots, etc? <- TODO
(If it’s long, please paste to https://ghostbin.com/ and insert the link here.)
Any other comments?
It's worth noting that the long term plan is to move to a more global filter plan which is being discussed in #1385.
Where has this been tested? <- TODO
Operating System: …
WordPress Version: …