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?
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744979922a4604380.html
评论列表(0条)