pre_comment_user_ip

過濾鉤子
apply_filters( 'pre_comment_user_ip', $commentdata['comment_author_IP'] )
引數
  • (string) $comment_author_ip The comment author's IP address.
    Required:
定義位置
相關勾子
pre_comment_user_agentpre_count_usersrest_comment_queryget_comment_author_ippre_comment_on_post
相關方法
get_comment_author_ipcomment_author_ipwp_comment_replyget_comment_guidget_current_user_idprevious_comments_link
引入
1.5.0
棄用
-

pre_comment_user_ip: 這是一個過濾鉤子,允許修改與評論一起儲存的使用者IP地址。該鉤子在評論提交時被觸發,並傳遞使用者IP地址作為引數。這個鉤子可以用來在使用者IP地址被儲存到資料庫之前對其進行淨化或驗證。

在設定評論作者的IP地址之前過濾該地址。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$commentdata['comment_author_IP'] = apply_filters( 'pre_comment_user_ip', $commentdata['comment_author_IP'] );
$commentdata['comment_author_IP'] = apply_filters( 'pre_comment_user_ip', $commentdata['comment_author_IP'] );
$commentdata['comment_author_IP'] = apply_filters( 'pre_comment_user_ip', $commentdata['comment_author_IP'] );

常見問題

FAQs
檢視更多 >