-
Notifications
You must be signed in to change notification settings - Fork 466
Closed
Labels
component: queryRelating to GraphQL QueriesRelating to GraphQL Queriesobject type: postRelating to the Post Object TypesRelating to the Post Object Typestype: bugIssue that causes incorrect or unexpected behaviorIssue that causes incorrect or unexpected behavior
Description
Description
Is there a way to query by URI?
I have attempted this, but I encountered an issue in my React frontend. When I use $slug with /test/, I receive the post as expected. The same happens when I use /news/test/.
However, I only want to receive the post for /news/test/.
Steps to reproduce
- Set backend permalink to
/news/%postname%/ - Try query
query GetPage($slug: String!) {
nodeByUri(uri: $slug) {
__typename
... on Page {
id
title
slug
}
... on Post {
id
title
slug
}
uri
}
}
First
{
"slug": "test"
}
Second
{
"slug": "/news/test"
}
Additional context
WPGraphQL Version
4.3.1
WordPress Version
6.6.2.
PHP Version
8.2.x
Additional environment details
Im at the moment testing it local.
Please confirm that you have searched existing issues in the repo.
- Yes
Please confirm that you have disabled ALL plugins except for WPGraphQL.
- Yes
- My issue is with compatibility with a specific WordPress plugin, and I have listed all my installed plugins (and version info) above.
Metadata
Metadata
Assignees
Labels
component: queryRelating to GraphQL QueriesRelating to GraphQL Queriesobject type: postRelating to the Post Object TypesRelating to the Post Object Typestype: bugIssue that causes incorrect or unexpected behaviorIssue that causes incorrect or unexpected behavior
Type
Projects
Status
✅ Done


