Make WordPress Core


Ignore:
Timestamp:
01/03/2020 06:42:09 PM (4 years ago)
Author:
kadamwhite
Message:

REST API: Short-circuit comment controller permissions check if commented-upon post type does not exist.

Props imani3011, dragosh635, subrataemfluence, timothyblynjacobs.
Fixes #42238.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

    r46823 r47036  
    15931593     */
    15941594    protected function check_read_post_permission( $post, $request ) {
    1595         $post_type        = get_post_type_object( $post->post_type );
     1595        $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
Note: See TracChangeset for help on using the changeset viewer.