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

feat: add connectedTerms connection to Taxonomy object #2256

Merged

Conversation

justlevine
Copy link
Collaborator

What does this implement/fix? Explain your changes.

This PR adds a connection from Taxonomy to TermNode, using the connectedTerms field.

{
  taxonomy(id: "category", idType: NAME) {
    connectedTerms {
      nodes {
        name
      }
    }
  }
}

This allows for more generic queries to be made, and is particular useful for post archives:

query getPostTypeArchive( $uri: String ){
  nodeByUri(uri: $uri) {
    ... on ContentType {
      connectedTaxonomies {
        nodes {
          label
          connectedTerms {
            nodes {
              name
              slug
              count
            }
          }
        }
      }
      contentNodes{
        nodes{
          uri
          ... on NodeWithTitle{
            title
          }
          ... on NodeWithContentEditor{
            content
          }
        }
      }
    }
  }
}

Any other comments?

Somewhat related to #2026 , as it creates a relationship between ContentNode and TermNode, albeit by using the ContentType as the intermediary.

Where has this been tested?

Operating System: Ubuntu 20.04

WordPress Version: 5.9.1

@justlevine
Copy link
Collaborator Author

justlevine commented Feb 27, 2022

codecept run wpunit is failing because there are leftover categories in the database - assuming because some tests arent cleaning up but I cant pinpoint where.
codecept run tests\wpunit\TaxonomyObjectQueriesTest.php::testTaxonomyQueryForCategories passes.

@jasonbahl
Copy link
Collaborator

jasonbahl commented Mar 3, 2022

@justlevine thanks for this PR! 🙏🏻

Yes, this is related to #2026. I hope to get that wrapped up here soon, and I'll include this with that, for sure.

I'm going to get v1.7.0 released first, then circle back to these.

@jasonbahl jasonbahl self-assigned this Mar 3, 2022
@jasonbahl jasonbahl added the Status: In Review Needs to be reviewed by a project maintainer before merge label Mar 3, 2022
@stale
Copy link

stale bot commented Aug 2, 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 label Aug 2, 2022
@stale
Copy link

stale bot commented Sep 1, 2022

This issue has been automatically closed because it has not had recent activity. If you believe this issue is still valid, please open a new issue and mark this as a related issue.

@stale stale bot closed this Sep 1, 2022
@justlevine justlevine reopened this Sep 2, 2022
@stale stale bot removed the stale label Sep 2, 2022
@stale
Copy link

stale bot commented Dec 1, 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 Dec 1, 2022
@stale
Copy link

stale bot commented Mar 1, 2023

This issue has been automatically closed because it has not had recent activity. If you believe this issue is still valid, please open a new issue and mark this as a related issue.

@stale stale bot closed this Mar 1, 2023
@justlevine justlevine reopened this Mar 1, 2023
…-connectedTerms-to-taxonomy

# Conflicts:
#	tests/wpunit/TaxonomyObjectQueriesTest.php
@codeclimate
Copy link

codeclimate bot commented Sep 13, 2023

Code Climate has analyzed commit 05b3973 and detected 0 issues on this pull request.

View more on Code Climate.

@coveralls
Copy link

coveralls commented Sep 13, 2023

Coverage Status

coverage: 84.558% (+0.03%) from 84.533% when pulling 05b3973 on justlevine:feat/add-connectedTerms-to-taxonomy into a2d5f4e on wp-graphql:develop.

@jasonbahl jasonbahl merged commit 4050581 into wp-graphql:develop Sep 14, 2023
27 checks passed
@justlevine justlevine deleted the feat/add-connectedTerms-to-taxonomy branch September 16, 2023 12:46
@jasonbahl jasonbahl mentioned this pull request Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale? May need to be revalidated due to prolonged inactivity Status: In Review Needs to be reviewed by a project maintainer before merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants