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建立評論而無需認證。

允許為匿名使用者建立評論。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$allow_anonymous = apply_filters( 'rest_allow_anonymous_comments', false, $request );
$allow_anonymous = apply_filters( 'rest_allow_anonymous_comments', false, $request );
$allow_anonymous = apply_filters( 'rest_allow_anonymous_comments', false, $request );

常見問題

FAQs
檢視更多 >