diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
index 117529d..90ca05f 100644
a
|
b
|
class WP_REST_Comments_Controller extends WP_REST_Controller { |
1527 | 1527 | * @return bool Whether post can be read. |
1528 | 1528 | */ |
1529 | 1529 | protected function check_read_post_permission( $post, $request ) { |
1530 | | $posts_controller = new WP_REST_Posts_Controller( $post->post_type ); |
| 1530 | $post_type = get_post_type_object( $post->post_type ); |
| 1531 | if ( $post_type->rest_controller_class && class_exists( $post_type->rest_controller_class ) ) { |
| 1532 | $posts_controller_class = $post_type->rest_controller_class; |
| 1533 | } else { |
| 1534 | $posts_controller_class = 'WP_REST_Posts_Controller'; |
| 1535 | } |
| 1536 | $posts_controller = new $posts_controller_class( $post->post_type ); |
| 1537 | |
1531 | 1538 | $post_type = get_post_type_object( $post->post_type ); |
1532 | 1539 | |
1533 | 1540 | $has_password_filter = false; |
diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php
index d3f665d..1c36741 100644
a
|
b
|
class WP_REST_Revisions_Controller extends WP_REST_Controller { |
53 | 53 | */ |
54 | 54 | public function __construct( $parent_post_type ) { |
55 | 55 | $this->parent_post_type = $parent_post_type; |
56 | | $this->parent_controller = new WP_REST_Posts_Controller( $parent_post_type ); |
| 56 | $post_type = get_post_type_object( $parent_post_type ); |
| 57 | if ( $post_type->rest_controller_class && class_exists( $post_type->rest_controller_class ) ) { |
| 58 | $parent_controller_class = $post_type->rest_controller_class; |
| 59 | } else { |
| 60 | $parent_controller_class = 'WP_REST_Posts_Controller'; |
| 61 | } |
| 62 | $this->parent_controller = new $parent_controller_class( $parent_post_type ); |
| 63 | |
57 | 64 | $this->namespace = 'wp/v2'; |
58 | 65 | $this->rest_base = 'revisions'; |
59 | 66 | $post_type_object = get_post_type_object( $parent_post_type ); |