@@ -48,11 +48,11 @@ public function register_rest_route()
48
48
{
49
49
// Get all sites
50
50
register_rest_route (
51
- self ::NAMESPACE , '/sites ' ,
51
+ self ::NAMESPACE , '/ ' . $ this -> rest_base ,
52
52
[
53
53
'methods ' => \WP_REST_Server::READABLE ,
54
54
'callback ' => [$ this ->get_sites , 'callback ' ],
55
- // 'permission_callback' => [$this, 'get_item_permissions_check'] ,
55
+ 'permission_callback ' => ' __return_true ' ,
56
56
'args ' => [
57
57
'page ' => [
58
58
'description ' => __ ('Current page of the result. ' ),
@@ -69,57 +69,43 @@ public function register_rest_route()
69
69
'type ' => 'boolean ' ,
70
70
'description ' => __ ('Retrieves the ACF fields from the site. ' ),
71
71
],
72
- 'gps ' => [
73
- 'default ' => false ,
74
- 'type ' => 'boolean ' ,
75
- 'description ' => __ ('Retrieves only the GPS coordinates of the site. ' ),
76
- ],
77
72
],
78
- // 'schema' => [$this, 'get_public_item_schema'],
73
+ 'schema ' => [$ this , 'get_public_item_schema ' ],
79
74
]
80
75
);
81
76
82
77
// Get site by blog ID
83
78
register_rest_route (
84
79
self ::NAMESPACE , '/ ' .$ this ->rest_base .'/(?P<id>[\d]+) ' ,
85
80
[
81
+ 'methods ' => \WP_REST_Server::READABLE ,
82
+ 'callback ' => [$ this ->get_site , 'callback ' ],
83
+ 'permission_callback ' => '__return_true ' ,
86
84
'args ' => [
87
85
'id ' => [
88
86
'description ' => __ ('Unique identifier for the object. ' ),
89
87
'type ' => 'integer ' ,
90
88
],
91
- ],
92
- [
93
- 'methods ' => \WP_REST_Server::READABLE ,
94
- 'callback ' => [$ this ->get_site , 'callback ' ],
95
- // 'permission_callback' => [$this, 'get_item_permissions_check'],
96
- 'args ' => [
97
- 'fields ' => [
98
- 'default ' => true ,
99
- 'type ' => 'boolean ' ,
100
- 'description ' => __ ('Retrieves the ACF fields from the site. ' ),
101
- ],
102
- 'gps ' => [
103
- 'default ' => false ,
104
- 'type ' => 'boolean ' ,
105
- 'description ' => __ ('Retrieves only the GPS coordinates of the site. ' ),
106
- ],
89
+ 'fields ' => [
90
+ 'default ' => true ,
91
+ 'type ' => 'boolean ' ,
92
+ 'description ' => __ ('Retrieves the ACF fields from the site. ' ),
107
93
],
108
94
],
109
95
'schema ' => [$ this , 'get_public_item_schema ' ],
110
96
]
111
97
);
112
98
}
113
99
114
- private function get_item_permissions_check ()
100
+ public function get_item_permissions_check ()
115
101
{
116
102
global $ wp_version ;
117
103
118
104
if (version_compare ($ wp_version , '4.8 ' , '>= ' )) {
119
105
return current_user_can ('setup_network ' );
120
106
}
121
107
122
- return is_super_admin ();
108
+ return is_admin ();
123
109
}
124
110
}
125
111
0 commit comments