Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft menu items still show #212

Open
ccorda opened this issue May 26, 2022 · 0 comments
Open

Draft menu items still show #212

ccorda opened this issue May 26, 2022 · 0 comments

Comments

@ccorda
Copy link
Contributor

ccorda commented May 26, 2022

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:
wp-graphql/wp-graphql#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant