WordPress.org

Make WordPress Core

Opened 2 weeks ago

Closed 10 days ago

#54422 closed defect (bug) (fixed)

WP_REST_Templates_Controller does not respect the fields param

Reported by: spacedmonkey Owned by: spacedmonkey
Milestone: 5.9 Priority: normal
Severity: normal Version: 5.8
Component: REST API Keywords: has-patch has-unit-tests
Focuses: rest-api Cc:

Description

WP_REST_Templates_Controller does not respect the fields param. The prepare_item_for_response method was not implemented correctly.

Change History (8)

This ticket was mentioned in PR #1870 on WordPress/wordpress-develop by spacedmonkey.


2 weeks ago

  • Keywords has-patch has-unit-tests added; needs-patch removed

This ticket was mentioned in Slack in #core-restapi by spacedmonkey. View the logs.


2 weeks ago

#3 @prbot
11 days ago

adamziel commented on PR #1870:

I read the PR and it makes sense, although I didn't have a chance to test it yet.

#4 @prbot
11 days ago

TimothyBJacobs commented on PR #1870:

Thanks for putting this together @spacedmonkey. Let's rename the test classes and test files to follow the standards while we're at it.

#5 @prbot
11 days ago

hellofromtonya commented on PR #1870:

Let's rename the test classes and test files to follow the standards while we're at it.

I took care of renaming file and test classes in commit https://github.com/WordPress/wordpress-develop/pull/1870/commits/27c3bb6af7fb37906f22c7974613b194159302d3.

#6 @prbot
11 days ago

TimothyBJacobs commented on PR #1870:

Thanks @hellofromtonya!

#7 @spacedmonkey
10 days ago

  • Milestone changed from Future Release to 5.9

#8 @spacedmonkey
10 days ago

  • Owner set to spacedmonkey
  • Resolution set to fixed
  • Status changed from new to closed

In 52186:

REST API: Make the templates controller follow core REST patterns.

The templates controller now respects the _fields parameter and filters the response accordingly. The schema has been updated to include all the fields returned. The content.block_version field has been added. The controller now returns WP_Error objects for improved error handling.

Add new unit tests.

Props TimothyBlynJacobs, hellofromtonya, zieladam.
Fixes #54422.

Note: See TracTickets for help on using tickets.