mirror of
https://hk.gh-proxy.com/https://github.com/mcp-wp/ai-command.git
synced 2025-10-03 10:10:57 +08:00
poc scoping
This commit is contained in:
parent
4cd2bfe607
commit
a6595eff35
2 changed files with 27 additions and 1 deletions
11
settings/route-additions.php
Normal file
11
settings/route-additions.php
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'post' => [
|
||||
'POST' => [
|
||||
'defaults' => [
|
||||
'status' => 'private',
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
|
@ -78,6 +78,21 @@ class RouteInformation
|
|||
return ! $this->is_singular();
|
||||
}
|
||||
|
||||
public function get_scope(): string
|
||||
{
|
||||
if ( ! $this->is_wp_rest_controller()) {
|
||||
return 'default';
|
||||
}
|
||||
|
||||
$context = [
|
||||
WP_REST_Posts_Controller::class => 'post',
|
||||
WP_REST_Users_Controller::class => 'user',
|
||||
WP_REST_Taxonomies_Controller::class => 'taxonomy',
|
||||
];
|
||||
|
||||
return $context[get_class($this->get_wp_rest_controller())];
|
||||
}
|
||||
|
||||
public function is_wp_rest_controller(): bool
|
||||
{
|
||||
// The callback form for a WP_REST_Controller is [ WP_REST_Controller, method ]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue