[wp-trac] [WordPress Trac] #49871: REST API post link should be permalink for scheduled posts
WordPress Trac
noreply at wordpress.org
Fri Apr 10 19:13:25 UTC 2020
#49871: REST API post link should be permalink for scheduled posts
-------------------------+-----------------------------
Reporter: Jules Colle | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version: trunk
Severity: normal | Keywords: 2nd-opinion
Focuses: rest-api |
-------------------------+-----------------------------
Scheduled posts now return something like this:
{{{
{
"id": 34,
"date": "2039-12-09T20:19:00",
"slug": "message-from-the-past",
"status": "future",
"link": "https://example.com/?p=34",
}
}}}
But I believe it makes more sense to actually return the permalink as
link:
{{{
{
"id": 34,
"date": "2039-12-09T20:19:00",
"slug": "message-from-the-past",
"status": "future",
"link": "https://example.com/2039/12/09/message-from-the-past",
}
}}}
The only caveat is that we will need to create 301 redirects in case the
slug changes (which is the case for published posts already).
For example. if the slug becomes `old-message` the new link would be
`https://example.com/2039/12/09/old-message`, but visiting
`https://example.com/2039/12/09/message-from-the-past` should redirect to
the new URL.
There has been some discussion about this over here:
https://github.com/WordPress/gutenberg/pull/21410#issuecomment-612132635
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49871>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list