Make WordPress Core

Opened 14 months ago

Last modified 6 months ago

#50074 new enhancement

Add filter on post/etc action links in the REST API

Reported by: rmccue Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.9.8
Component: REST API Keywords: needs-patch good-first-bug
Focuses: Cc:


With Gutenberg increasingly using more action links to control behaviour in the block editor, having a filter to adjust these links would be super useful. This allows developers to avoid a shotgun approach of hacking Gutenberg's UI, or using the very low-level filters to remove these actions.

This is probably useful to have as a general API to also add additional actions; e.g. for implementing something similar to Gutenberg's actions.

Change History (2)

#1 @TimothyBlynJacobs
13 months ago

  • Keywords good-first-bug added
  • Milestone changed from Awaiting Review to Future Release
  • Type changed from defect (bug) to enhancement
  • Version set to 4.9.8

This makes sense to me. We'd probably also want a filter on get_schema_links.

#2 @patopaiar
6 months ago

@TimothyBlynJacobs I would like to contribute with this ticket, but I am not 100% sure of which links exactly would be the ones that need a filter added.

For your comment it is clearer, in get_schema_links function line 2452, instead of

$schema_links = $this->get_schema_links();

We can do

$schema_links = apply_filters( "rest_{$this->post_type}_item_schema_links" , $this->get_schema_links() );

But for the action links, how can I figure out which ones to add filters to?

Note: See TracTickets for help on using tickets.