REST API: Reuse namespace property instead of the undeclared rest_namespace.

Props itowhid06.
Fixes #48297.


git-svn-id: https://develop.svn.wordpress.org/trunk@49300 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Timothy Jacobs 2020-10-24 13:52:22 +00:00
parent b8cdf1be50
commit 84e533ab9d

View File

@ -67,7 +67,7 @@ class WP_REST_Autosaves_Controller extends WP_REST_Revisions_Controller {
$this->parent_controller = $parent_controller;
$this->revisions_controller = new WP_REST_Revisions_Controller( $parent_post_type );
$this->rest_namespace = 'wp/v2';
$this->namespace = 'wp/v2';
$this->rest_base = 'autosaves';
$this->parent_base = ! empty( $post_type_object->rest_base ) ? $post_type_object->rest_base : $post_type_object->name;
}
@ -81,7 +81,7 @@ class WP_REST_Autosaves_Controller extends WP_REST_Revisions_Controller {
*/
public function register_routes() {
register_rest_route(
$this->rest_namespace,
$this->namespace,
'/' . $this->parent_base . '/(?P<id>[\d]+)/' . $this->rest_base,
array(
'args' => array(
@ -107,7 +107,7 @@ class WP_REST_Autosaves_Controller extends WP_REST_Revisions_Controller {
);
register_rest_route(
$this->rest_namespace,
$this->namespace,
'/' . $this->parent_base . '/(?P<parent>[\d]+)/' . $this->rest_base . '/(?P<id>[\d]+)',
array(
'args' => array(