Getting Wrong Data via WPGRAPHQL Query
-
My WordPress Menu: https://ibb.co/TTCs2cz
I am getting Child Page twice, once it is shown as a child page and another time it is displayed as a Level one Menu item, It must not show as a Level 1 menu page.
Is it a bug in the plugin or I am doing it the wrong way????
My WPGRAPHQL Queryquery mainMenu { menu(idType: NAME, id: "main menu") { menuItems { edges { node { id uri title target label childItems { edges { node { id uri title target label parentId } } } } } } } }
WPGRAPHQL Query 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." } ] } }
Expected 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": "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 ‘Getting Wrong Data via WPGRAPHQL Query’ is closed to new replies.