[wp-trac] [WordPress Trac] #61639: REST API: Posts/Pages endpoint prefixes private pages titles.
WordPress Trac
noreply at wordpress.org
Fri Jul 12 08:49:36 UTC 2024
#61639: REST API: Posts/Pages endpoint prefixes private pages titles.
-------------------------+-----------------------------
Reporter: youknowriad | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: REST API | Version: 4.7
Severity: normal | Resolution:
Keywords: needs-patch | Focuses: rest-api
-------------------------+-----------------------------
Changes (by swissspidy):
* keywords: => needs-patch
* version: => 4.7
* type: defect (bug) => enhancement
* milestone: Awaiting Review => Future Release
Comment:
I don't think there was a conscious decision to explicitly add this to the
REST API. It simply uses `get_the_title()` internally which happens to add
the "Private:" prefix (but only if you are not in the admin!).
By default, `get_the_title()` adds a "Protected:" prefix too, but the REST
API removes it (see
`\WP_REST_Posts_Controller::protected_title_format()`). This was added in
https://github.com/WP-API/WP-API/pull/2720 because you can still access a
protected post in the API, but you can't see the content & excerpt fields.
For consistency reasons it sounds reasonable to me to omit the prefix for
"Private" as well. Would probably be good to mention it in a misc dev note
if it lands.
---
Aside: `Private: ` for empty private pages is just wrong IMO.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61639#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list