protected function get_rest_base($request)
{
global $wp_taxonomies;
$taxonomy = false;
if ($request instanceof WP_REST_Request) {
$taxonomy = $request->get_param('taxonomy');
}
if ($taxonomy && !array_key_exists($taxonomy, $wp_taxonomies)) {
foreach ($wp_taxonomies as $tax_key => $tax_value) {
if (isset($tax_value->rest_base) && $taxonomy == $tax_value->rest_base) {
$request->set_param('taxonomy', $tax_key);
return $tax_key;
}
}
}
return $taxonomy;
}