WordPress 如何限制 REST API 匿名访问?
WordPress 可通过 rest_authentication_errors 钩子要求所有 REST API 请求完成身份验证,未登录访客将收到 401 Unauthorized。也可借助 rest_endpoints 过滤器移除 /users 等敏感端点,或使用免费的 Disable REST API、Wordfence Security / iThemes Security 控制匿名访问。
WordPress 可通过 rest_authentication_errors 钩子要求所有 REST API 请求完成身份验证,未登录访客将收到 401 Unauthorized。也可借助 rest_endpoints 过滤器移除 /users 等敏感端点,或使用免费的 Disable REST API、Wordfence Security / iThemes Security 控制匿名访问。