Make WordPress Core


Ignore:
Timestamp:
09/30/2025 04:50:20 PM (11 months ago)
Author:
johnbillion
Message:

REST API: Increase the specificity of capability checks for collections when the edit context is in use.

The edit access in now taken into account for each individual post, term, or user in the response.

Merges [60814] into the 6.8 branch.

Props andraganescu, desrosj, ehti, hurayraiit, iandunn, joehoyle, johnbillion, jorbin, mnelson4, noisysocks, peterwilsoncc, rmccue, timothyblynjacobs, vortfu, whyisjake, zieladam.

Location:
branches/6.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.8

  • branches/6.8/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r60200 r60817  
    464464
    465465                        foreach ( $query_result as $post ) {
    466                                 if ( ! $this->check_read_permission( $post ) ) {
     466                                if ( 'edit' === $request['context'] ) {
     467                                        $permission = $this->check_update_permission( $post );
     468                                } else {
     469                                        $permission = $this->check_read_permission( $post );
     470                                }
     471
     472                                if ( ! $permission ) {
    467473                                        continue;
    468474                                }
Note: See TracChangeset for help on using the changeset viewer.