Make WordPress Core


Ignore:
Timestamp:
10/08/2019 01:41:29 PM (5 years ago)
Author:
kadamwhite
Message:

REST API: Ensure rest_controller instantiates the post type's declared REST controller class.

Ensures that the ::get_rest_controller() method will always return an instanceof the expected controller class, or null.
Removes unused private static property $post_type_controllers.

Props dlh, TimothyBlynJacobs.
Fixes #45677.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-post-type.php

    r46272 r46435  
    344344     * @var WP_REST_Controller $rest_controller
    345345     */
    346     private $rest_controller;
     346    public $rest_controller;
    347347
    348348    /**
     
    723723        }
    724724
     725        if ( ! ( $this->rest_controller instanceof $class ) ) {
     726            return null;
     727        }
     728
    725729        return $this->rest_controller;
    726730    }
Note: See TracChangeset for help on using the changeset viewer.