[wp-trac] [WordPress Trac] #49116: Add Links to the REST version of a Resource in the header of the page
WordPress Trac
noreply at wordpress.org
Mon Jun 8 06:34:16 UTC 2020
#49116: Add Links to the REST version of a Resource in the header of the page
-------------------------------------------------+-------------------------
Reporter: dshanske | Owner: dshanske
Type: enhancement | Status: assigned
Priority: normal | Milestone: 5.5
Component: REST API | Version: 4.7
Severity: normal | Resolution:
Keywords: needs-patch needs-unit-tests dev- | Focuses: rest-api
feedback |
-------------------------------------------------+-------------------------
Comment (by tfrommen):
This is an interesting ticket, and it's also very similar to something I
wanted to do for the longest time: have a "See in REST API" node in the
admin bar that would link to the according REST API request both when
editing a resource or when viewing it on the frontend. I imagined it
making use of `get_queried_object(_id)`and conditionals, just like you, so
having functions like `rest_get_route_for_(post|term)` would certainly
help.
That said, here are some minor nitpicks on the last patch, @dshanske:
* You might want to remove that `error_log` on L1849. ;)
* In PHP, the `instanceof` keyword is all lowercase (L1839).
* Using `is_attachment` is unnecessary as `is_singular` will cover that,
too.
Also, why did you pass in `application/json` via `esc_attr` instead of
just hard-coded right in the placeholder string (L1790)?
Looking forward to having this in Core. Thanks! :)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/49116#comment:13>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list