WP_Post_Type::get_revisions_rest_controller()
Gets the REST API revisions controller for this post type.
Will only instantiate the controller class once per request.
Метод класса: WP_Post_Type{}
Хуков нет.
Возвращает
WP_REST_Controller|null
. The controller instance, or null if the post type is set not to show in rest.
Использование
$WP_Post_Type = new WP_Post_Type(); $WP_Post_Type->get_revisions_rest_controller();
Список изменений
С версии 6.4.0 | Введена. |
Код WP_Post_Type::get_revisions_rest_controller() WP Post Type::get revisions rest controller WP 6.7.1
public function get_revisions_rest_controller() { if ( ! $this->show_in_rest ) { return null; } if ( ! post_type_supports( $this->name, 'revisions' ) ) { return null; } $class = $this->revisions_rest_controller_class ? $this->revisions_rest_controller_class : WP_REST_Revisions_Controller::class; if ( ! class_exists( $class ) ) { return null; } if ( ! is_subclass_of( $class, WP_REST_Controller::class ) ) { return null; } if ( ! $this->revisions_rest_controller ) { $this->revisions_rest_controller = new $class( $this->name ); } if ( ! ( $this->revisions_rest_controller instanceof $class ) ) { return null; } return $this->revisions_rest_controller; }