#54055 closed enhancement (fixed)
Add visibility field to Post type controller
Reported by: | spacedmonkey | Owned by: | TimothyBlynJacobs |
---|---|---|---|
Milestone: | 5.9 | Priority: | normal |
Severity: | normal | Version: | 4.7 |
Component: | REST API | Keywords: | has-patch has-unit-tests |
Focuses: | rest-api | Cc: |
Description
Original ticket from gutenberg repo 34443.
Add a new field to the Post types REST API controller called visibility
. This field would be work similarly to the visibility
field found in the taxonomy REST API controller.
Change History (11)
This ticket was mentioned in PR #1650 on WordPress/wordpress-develop by spacedmonkey.
3 years ago
#1
- Keywords has-patch added
TimothyBJacobs commented on PR #1650:
3 years ago
#3
We may want to look at is_post_type_viewable
.
spacedmonkey commented on PR #1650:
3 years ago
#4
We may want to look at
is_post_type_viewable
.
This data is already in the endpoint.
TimothyBJacobs commented on PR #1650:
3 years ago
#5
Ah, my mistake. So should we still be exposing public
and publicly_queryable
then?
peterwilsoncc commented on PR #1650:
3 years ago
#6
So should we still be exposing
public
andpublicly_queryable
then?
public
should probably not be exposed, it's pretty meaningless. A post type can be public
without being viewable by registering a CPT with these arguments:
{{{php
[
'public' => true,
'exclude_from_search' => true,
'publicly_queryable' => false,
'show_in_nav_menus' => false,
'show_ui' => false,
'show_in_rest' => false,
]
}}}
publicly_queryable
is of more use as it's what determines if a post type is viewable for CPTs but going via the helper function is_post_type_viewable()
is the safest result.
spacedmonkey commented on PR #1650:
3 years ago
#7
@peterwilsoncc Good catch. I have removed it now.
TimothyBJacobs commented on PR #1650:
3 years ago
#8
We should be ditching publicly_queryable
as well then, right? Since we are already exposing the correct computed value?
#9
@
3 years ago
- Milestone changed from Awaiting Review to 5.9
- Owner set to TimothyBlynJacobs
- Status changed from new to accepted
- Type changed from defect (bug) to enhancement
- Version set to 4.7
See this issue for more information https://github.com/WordPress/gutenberg/issues/34443
Trac ticket: https://core.trac.wordpress.org/ticket/54055