admin管理员组文章数量:1406140
I have a headless WordPress setup with the following stack:
Backend:
- WordPress Bedrock
- Sage 10
- WPGraphQL
- Polylang Pro
Frontend:
- Next.js
- Faust.js
I have a custom post type (CPT) called "workouts", and I’m trying to query the archive page using GraphQL:
query NewQuery {
nodeByUri(uri: "/workouts") {
uri
... on ContentType {
id
name
}
}
}
Issue:
If I disable the "Translate Archive" option in Polylang, I get the correct response:
{
"data": {
"nodeByUri": {
"uri": "/workouts/",
"id": "cG9zdF90eXBlOndvcmtvdXRz",
"name": "workouts"
}
}
}
However, if I enable the "Translate Archive" option, I get null
instead:
{
"data": {
"nodeByUri": null
}
}
When I try using the translated slug (/es/workouts/
), I get an internal server error:
{
"errors": [
{
"debugMessage": "Undefined property: WP_Taxonomy::$graphql_single_name",
"message": "Internal server error",
"extensions": {
"category": "internal"
},
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"nodeByUri"
]
}
],
"data": {
"nodeByUri": null
}
}
Question:
How can I properly query my CPT archive page when the Translate Archive option is enabled in Polylang?
本文标签:
版权声明:本文标题:wordpress - nodeByUri returns null in GraphQL when Polylang "Translate Archive" is enabled - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744979921a2635753.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论