WPGraphQL query returning wrong data I guess
-
According to my query, it should fetch the childItem under its parent page only but in my case, it is showing the child page as ChildItem as well as the main page also which is very confusing… Is it a bug in the plugin or I am doing it in the wrong way?
Image of my WP menu
https://ibb.co/TTCs2czQUERY:
query mainMenu { menu(idType: NAME, id: "main menu") { menuItems { edges { node { id uri title target label childItems { edges { node { id uri title target label parentId } } } } } } } }
Result:
{ "data": { "menu": { "menuItems": { "edges": [ { "node": { "id": "cG9zdDozNA==", "uri": "/", "title": "home link", "target": null, "label": "Home", "childItems": { "edges": [] } } }, { "node": { "id": "cG9zdDozMA==", "uri": "/about-us/", "title": null, "target": null, "label": "About Us", "childItems": { "edges": [ { "node": { "id": "cG9zdDo2MQ==", "uri": "/child-page/", "title": null, "target": null, "label": "Child page", "parentId": "cG9zdDozMA==" } } ] } } }, { "node": { "id": "cG9zdDo2MQ==", "uri": "/child-page/", "title": null, "target": null, "label": "Child page", "childItems": { "edges": [] } } }, { "node": { "id": "cG9zdDoyOA==", "uri": "/portfolio/", "title": null, "target": null, "label": "Portfolio", "childItems": { "edges": [] } } }, { "node": { "id": "cG9zdDoyOQ==", "uri": "/services/", "title": null, "target": null, "label": "Services", "childItems": { "edges": [] } } }, { "node": { "id": "cG9zdDoyNw==", "uri": "/contact-us/", "title": null, "target": null, "label": "Contact Us", "childItems": { "edges": [] } } }, { "node": { "id": "cG9zdDozNw==", "uri": "/policy/", "title": null, "target": null, "label": "Policy", "childItems": { "edges": [] } } } ] } } }, "extensions": { "debug": [ { "type": "DEBUG_LOGS_INACTIVE", "message": "GraphQL Debug logging is not active. To see debug logs, GRAPHQL_DEBUG must be enabled." } ] } }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘WPGraphQL query returning wrong data I guess’ is closed to new replies.