WP_REST_Templates_Controller::get_available_actions
Get the link relations available for the post and current user.
Метод класса: WP_REST_Templates_Controller{}
Хуков нет.
Возвращает
Строку[]. List of link relations.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_available_actions();
Список изменений
| С версии 5.8.0 | Введена. |
Код WP_REST_Templates_Controller::get_available_actions() WP REST Templates Controller::get available actions WP 6.9.4
protected function get_available_actions() {
$rels = array();
$post_type = get_post_type_object( $this->post_type );
if ( current_user_can( $post_type->cap->publish_posts ) ) {
$rels[] = 'https://api.w.org/action-publish';
}
if ( current_user_can( 'unfiltered_html' ) ) {
$rels[] = 'https://api.w.org/action-unfiltered-html';
}
return $rels;
}