AxeWP / wp-graphql-rank-math

Add GraphQL support for RankMath SEO
GNU General Public License v3.0
49 stars 7 forks source link

Missing field in allowed fields makes field null when user not logged in #100

Closed marziolek closed 4 weeks ago

marziolek commented 1 month ago

https://github.com/AxeWP/wp-graphql-rank-math/blob/9fd2f1cc7026a029493b172eb2be1cb30948a12a/src/Model/Seo.php#L80

justlevine commented 1 month ago

Hey @marziolek I'm travellng, and you kinda just threw out the GH issue template that helps speed along triage.

Can you start by specifying which field (and on which GraphQL object - the class you shared is an abstract model shared by several SeoObject types) you believe is missing and should be available to unauthenticated users?

marziolek commented 1 month ago

@justlevine sorry about that. Dropped it too quickly. Amazing that you responded that fast! When making this query in Graphql IDE

query SEOData {
  nodeByUri(uri: "/portfolio") {
    ... on NodeWithRankMathSeo {
      seo {
        canonicalUrl
      }
    }
  }
}

canonicalUrl field is always null, unless you switch to logged-in user. image When added canonicalUrl to fields mentioned above it worked every time.