WordPress.org

Make WordPress Core

Ticket #42238: 42238-updated.patch

File 42238-updated.patch, 1.2 KB (added by imani3011, 9 months ago)

Updated Patch for #42238 fix

  • src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

    From facece4fa16bec55ecb1509d013b30f3c36a7ce8 Mon Sep 17 00:00:00 2001
    From: Himani <himaniwork3010@gmail.com>
    Date: Mon, 25 Nov 2019 10:01:26 +0530
    Subject: [PATCH] Fix: #42238 Notice when Rest Comments controller is checking
    
    ---
     .../endpoints/class-wp-rest-comments-controller.php         | 6 ++++++
     1 file changed, 6 insertions(+)
    
    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 4fce45878c..87c982f52f 100644
    a b class WP_REST_Comments_Controller extends WP_REST_Controller { 
    15931593         */
    15941594        protected function check_read_post_permission( $post, $request ) {
    15951595                $post_type        = get_post_type_object( $post->post_type );
     1596               
     1597                // Return false if custom post type doesn't exist
     1598                if ( ! $post_type ) {
     1599                        return false;
     1600                }
     1601               
    15961602                $posts_controller = $post_type->get_rest_controller();
    15971603
    15981604                // Ensure the posts controller is specifically a WP_REST_Posts_Controller instance