Skip to content

Handle default category from wordpress #1887

Description

@jooola

This is more a question than a bug.

How to handle default category for a post, since graphql returns a empty array for the node categories but WordPress does provide a default category when none specified ?

I feel this is the intended behavior of wp-graphql, so I was thinking fetching the default category in a query and put the logic in my front-end code. Is that the best way to do this ?

How could I query the default category from wordpress ? At first querying the category with the id 1 was my guess, but the default category can be changed.

Any tips are very welcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    close candidateNeeds confirmation before closinghas: workaroundA temporary workaround has been providedtype: questionAn issue that involve inquiries, clarifications, or requests for guidance

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions