Skip to content

Introduce Archive Interfaces #2491

@jasonbahl

Description

@jasonbahl

What problem does this address?

Currently, Archives for post types return a ContentType Type.

This is difficult to use as it treats every Archive the same, when there are often differences.

For example, the Archive for the "post" post type can have a formal association with the "Posts Page" as set in "Reading Settings", and that relationship should be exposed on the Post Archive, but not on all "ContentType" types. (see: #2486 (comment))

What is your proposed solution?

We might be able to start by converting ContentType into an Interface and then introducing new PostArchive, HouseArchive, CarArchive, etc types for each post type that has archive support.

ex:

type PostArchive implements ContentType {
...
}

type CarArchive implements ContentType {
...
}

We probably actually want to introduce a new Interface in-between, like ContentArchive

So then it might be:

interface ContentArchive implements ContentType {
...
}

interface PostArchive implements ContentArchive & ContentType { 
... 
}

Where all post types (with archive support or not) are considered a "ContentType", but only post types that have archive support would implement the ContentArchive interface.

What alternatives have you considered?

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: interfacesRelating to GraphQL Interface Typesneeds: discussionRequires a discussion to proceedscope: apiIssues related to access functions, actions, and filterstype: featureNew functionality being added

    Projects

    Status

    💬 In Discussion

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions