From 804bb2031643b19a1787442f220a5e2419e2a0d2 Mon Sep 17 00:00:00 2001
From: Himani <himaniwork3010@gmail.com>
Date: Sun, 24 Nov 2019 19:35:39 +0530
Subject: [PATCH] Fix: #42238 Notice when Rest Comments controller is checking
permission for a non existent post type
---
.../rest-api/endpoints/class-wp-rest-comments-controller.php | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php
index f673450d41..c9dda586fa 100644
|
a
|
b
|
class WP_REST_Comments_Controller extends WP_REST_Controller { |
| 1584 | 1584 | protected function check_read_post_permission( $post, $request ) { |
| 1585 | 1585 | $posts_controller = new WP_REST_Posts_Controller( $post->post_type ); |
| 1586 | 1586 | $post_type = get_post_type_object( $post->post_type ); |
| | 1587 | // Return false if custom post type doesn't exist |
| | 1588 | if(is_null($post_type)) { |
| | 1589 | return false; |
| | 1590 | } |
| 1587 | 1591 | |
| 1588 | 1592 | $has_password_filter = false; |
| 1589 | 1593 | |