[wp-trac] [WordPress Trac] #49623: Hierarchical Custom Post Types do not show up in the REST API
WordPress Trac
noreply at wordpress.org
Wed Mar 11 13:57:08 UTC 2020
#49623: Hierarchical Custom Post Types do not show up in the REST API
----------------------------------+-----------------------------
Reporter: alanford123 | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: 5.3.2
Severity: normal | Keywords: needs-patch
Focuses: javascript, rest-api |
----------------------------------+-----------------------------
When querying custom post types that are hierarchical, every non-parent
item does not get returned.
To reproduce:
Create a custom post type, with
{{{
'hierarchical' => true,
}}}
Add some items, and set some to be child items.
Try to get a list of all the items using REST API, as such:
{{{
?rest_route=/wp/v2/-custom-post-type-
}}}
Observe that not all items get returned. All that are child items do not
get returned.
It may have something to do with the url structure. Pages work as
expected, and pages have all items with the same URL structure,
{{{
?page_id=1
}}}
Regardless of being child or not.
Custom post types have a different url structure, where the items dont
actually have id as their URL, but their slug.
CHild items have "parent-slug/child-slug"
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49623>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list