WPSEO_Post_Type::is_rest_enabled
Checks if the post type is enabled in the REST API.
Метод класса: WPSEO_Post_Type{}
Хуков нет.
Возвращает
true|false. Whether or not the post type is available in the REST API.
Использование
$result = WPSEO_Post_Type::is_rest_enabled( $post_type );
- $post_type(строка) (обязательный)
- The post type to check.
Код WPSEO_Post_Type::is_rest_enabled() WPSEO Post Type::is rest enabled Yoast 27.7
public static function is_rest_enabled( $post_type ) {
$post_type_object = get_post_type_object( $post_type );
if ( $post_type_object === null ) {
return false;
}
return $post_type_object->show_in_rest === true;
}