Open ccorda opened 2 years ago
Currently we have a site where a bunch of pages were set to draft, but they are still appearing in the published site menus.
It looks like wp-graphql returns menu items regardless of the connectedObjects post status: https://github.com/wp-graphql/wp-graphql/issues/891
We can add this graphql to see the status of the object:
nodes{ connectedObject { ... on Page { id status } } }
When it returns a public response, we're good:
"connectedObject": { "id": "cG9zdDoxMjIw", "status": "publish" }
However it's hard to distinguish an unpublished page:
{ "id": "cG9zdDo2NjQ=", "databaseId": 664, "label": "Events", "parentId": "cG9zdDo2NjE=", "url": "https://site.wpengine.com/?page_id=205", "path": "/", "target": null, "cssClasses": [], "connectedObject": null },
and an external url:
{ "id": "cG9zdDo5NTQ=", "databaseId": 954, "label": "Local Partners", "parentId": "cG9zdDoxMDk1", "url": "https://site.com/partners#local-partners", "path": "https://site.com/partners#local-partners", "target": null, "cssClasses": [], "connectedObject": null },
One possibility is to exclude anything with ?page_id in it, but that feels potentially unreliable.
?page_id
Currently we have a site where a bunch of pages were set to draft, but they are still appearing in the published site menus.
It looks like wp-graphql returns menu items regardless of the connectedObjects post status: https://github.com/wp-graphql/wp-graphql/issues/891
We can add this graphql to see the status of the object:
When it returns a public response, we're good:
However it's hard to distinguish an unpublished page:
and an external url:
One possibility is to exclude anything with
?page_id
in it, but that feels potentially unreliable.