我想验证发送到终点的数据。
https://www.shawnhooper.ca/2017/02/15/wp-rest-secrets-found-reading-core-code/这篇文章引用了未记录的验证选项。我已经得到了我所需要的90%,但现在需要验证一个字符串长度,我似乎无法弄清楚。
基本上,我需要说最大长度是X。我尝试了“maxLength”,但这不起作用。有没有人做过这个或者做得更好,还有没有关于这个的文档,我发现的帖子很旧。
\'args\' => array(
\'external_id\' => array(
\'required\' => true,
\'type\' => \'string\',
\'description\' => \'external id\',
\'maxLength\' => 10
)
)
谢谢,安迪