WP_REST_Posts_Controller::check_is_post_type_allowed()
Checks if a given post type can be viewed or managed.
Метод класса: WP_REST_Posts_Controller{}
Хуков нет.
Возвращает
true|false
. Whether the post type is allowed in REST.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->check_is_post_type_allowed( $post_type );
- $post_type(WP_Post_Type|строка) (обязательный)
- Post type name or object.
Список изменений
С версии 4.7.0 | Введена. |
Код WP_REST_Posts_Controller::check_is_post_type_allowed() WP REST Posts Controller::check is post type allowed WP 6.7.2
protected function check_is_post_type_allowed( $post_type ) { if ( ! is_object( $post_type ) ) { $post_type = get_post_type_object( $post_type ); } if ( ! empty( $post_type ) && ! empty( $post_type->show_in_rest ) ) { return true; } return false; }