使用无头 WordPress 和 WPGraphQL,当页面设置为draft
状态,并且我尝试将页面拉入我的 React 导航时,站点会中断。如何过滤掉设置为draft
状态的页面/帖子,或者将它们拉入然后在前端过滤?
query appQuery($locationId: MenuLocationEnum!) {
menuItems(where: { location: $locationId }) {
edges {
node {
id
title
label
menuItemId
connectedObject {
__typename
... on Post {
id
slug
status <--Provides "publish" or "draft" in GraphIQL in WordPress dashboard
}
... on Page {
id
slug
pageId
status <--Provides "publish" or "draft" in GraphIQL in WordPress dashboard
}
}
}
}
}