Make WordPress Core

Opened 8 weeks ago

Last modified 8 weeks ago

#63056 assigned enhancement

Add Missing rest_prepare_ Filters to Several REST API Controllers

Reported by: vipulpatil's profile vipulpatil Owned by: vipulpatil's profile vipulpatil
Milestone: Awaiting Review Priority: normal
Severity: normal Version: trunk
Component: REST API Keywords: changes-requested has-patch
Focuses: rest-api, coding-standards Cc:

Description

Issue
Several WordPress REST API controllers lack rest_prepare_ filters, creating inconsistent extensibility across different resource types. The affected controllers do not provide a standard mechanism for developers to modify API responses, limiting the ability to customize or extend REST API outputs.

Proposed Solution
Implement rest_prepare_ filters for the following controllers:

class-wp-rest-block-patterns-controller
class-wp-rest-block-pattern-categories-controller
class-wp-rest-global-styles-controller
class-wp-rest-templates-controller
class-wp-rest-template-revisions-controller
class-wp-rest-template-autosaves-controller
class-wp-rest-search-controller

Add a standard filter implementation in each controller's prepare_item_for_response() method:

Change History (1)

This ticket was mentioned in PR #8462 on WordPress/wordpress-develop by @vipulpatil.


8 weeks ago
#1

  • Keywords has-patch added

## Summary
This PR adds new rest_prepare_ filters to block pattern-related REST API controllers, enhancing the extensibility of WordPress REST API for block patterns and block pattern categories.

### Changes Made

  • Added rest_prepare_block_pattern filter to class-wp-rest-block-patterns-controller
  • Added rest_prepare_block_pattern_category filter to class-wp-rest-block-patterns-categories-controller

Trac ticket: https://core.trac.wordpress.org/ticket/63056

Note: See TracTickets for help on using tickets.