Skip to content

[Feature Request] REST API endpoint for pulling posts from primary category #6251

@ChrisFlannagan

Description

@ChrisFlannagan

Looked for a function or api method to pull posts that have a specific primary category

I wrote up a blog article on how I pulled this off and Joost asked me to open an issue. My solution works, it's slightly custom to my specific needs by pulling in children as well, but seems to do the trick and easy to adjust.

https://whoischris.com/yoast-primary-category-endpoint-wp-rest-api/

https://gist.github.com/ChrisFlannagan/a6f63a02ea16268a25bc5d386e9ac63a#file-primary-cat-php

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions