Skip to content

Unable to change from mutation updateCategory to top level #3296

@kinnn2

Description

@kinnn2

Description

trying to modify a subcategory element to be a top-level category, but it's not working.
tried parentId value of null, -1, and 0.
Moving from a subcategory to another subcategory works fine
Moving to the top level is not working.
I'm confused if it's a bug or tried that doesn't work by default in wp-graphql.

Steps to reproduce

mutation updateCaegory($id: ID!, $parentId: ID) {
  updateCategory(input: {id: $id, parentId: $parentId, clientMutationId: "34343"}) {
    category {
      id
      databaseId
      parentDatabaseId
      name
      parentId
    }
    clientMutationId
  }
}
{
"id":37,
"parentId":0
}
{
"id":37,
"parentId": null
}
{
"id":37,
"parentId": -1
}

Additional context

No response

WPGraphQL Version

1.31.1

WordPress Version

6.7.1

PHP Version

8.1.29

Additional environment details

No response

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: mutationsRelating to GraphQL Mutationsobject type: termRelating to the Term Typestype: bugIssue that causes incorrect or unexpected behavior

Type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions