File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ return [
4+ 'post ' => [
5+ 'POST ' => [
6+ 'defaults ' => [
7+ 'status ' => 'private ' ,
8+ ],
9+ ],
10+ ],
11+ ];
Original file line number Diff line number Diff line change @@ -78,10 +78,25 @@ public function is_list(): bool
7878 return ! $ this ->is_singular ();
7979 }
8080
81+ public function get_scope (): string
82+ {
83+ if ( ! $ this ->is_wp_rest_controller ()) {
84+ return 'default ' ;
85+ }
86+
87+ $ context = [
88+ WP_REST_Posts_Controller::class => 'post ' ,
89+ WP_REST_Users_Controller::class => 'user ' ,
90+ WP_REST_Taxonomies_Controller::class => 'taxonomy ' ,
91+ ];
92+
93+ return $ context [get_class ($ this ->get_wp_rest_controller ())];
94+ }
95+
8196 public function is_wp_rest_controller (): bool
8297 {
8398 // The callback form for a WP_REST_Controller is [ WP_REST_Controller, method ]
84- if ( ! is_array ( $ this ->callback ) ) {
99+ if ( ! is_array ($ this ->callback ) ) {
85100 return false ;
86101 }
87102
You can’t perform that action at this time.
0 commit comments