rest_allow_anonymous_comments

过滤钩子
apply_filters( 'rest_allow_anonymous_comments', false, $request )
参数
  • (bool) $allow_anonymous Whether to allow anonymous comments to be created. Default `false`.
    Required:
  • (WP_REST_Request) $request Request used to generate the response.
    Required:
定义位置
相关勾子
wp_anonymize_commentrest_insert_commentallow_empty_commentrest_after_insert_commentrest_pre_insert_comment
相关方法
register_block_core_commentswp_allow_commentregister_block_core_post_comments_formregister_legacy_post_comments_blockget_page_of_commentrender_block_core_comments
引入
4.7.0
弃用
-

rest_allow_anonymous_comments – 这个钩子用来确定WordPress REST API中是否允许匿名评论。默认情况下,匿名评论是不允许的,但是如果需要的话,开发者可以使用这个钩子来改变这个行为,允许匿名评论。

过滤是否可以通过REST API创建评论而无需认证。

允许为匿名用户创建评论。

$allow_anonymous = apply_filters( 'rest_allow_anonymous_comments', false, $request );

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-06 03:33:08

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: