Gets the REST API autosave controller for this post type.
Description
Will only instantiate the controller class once per request.
Source
return null;
}
return $this->revisions_rest_controller;
}
/**
* Gets the REST API autosave controller for this post type.
*
* Will only instantiate the controller class once per request.
*
* @since 6.4.0
*
* @return WP_REST_Controller|null The controller instance, or null if the post type
* is set not to show in rest.
*/
public function get_autosave_rest_controller() {
if ( ! $this->show_in_rest ) {
return null;
}
if ( ! post_type_supports( $this->name, 'autosave' ) ) {
return null;
}
$class = $this->autosave_rest_controller_class ? $this->autosave_rest_controller_class : WP_REST_Autosaves_Controller::class;
if ( ! class_exists( $class ) ) {
return null;
Changelog
Version | Description |
---|---|
6.4.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.