pre_comment_user_agent

過濾鉤子
apply_filters( 'pre_comment_user_agent', ( isset( $commentdata['comment_agent'] )

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

在設定評論作者的瀏覽器使用者代理之前過濾它。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$commentdata['comment_agent'] = apply_filters( 'pre_comment_user_agent', ( isset( $commentdata['comment_agent'] ) ? $commentdata['comment_agent'] : '' ) );
$commentdata['comment_agent'] = apply_filters( 'pre_comment_user_agent', ( isset( $commentdata['comment_agent'] ) ? $commentdata['comment_agent'] : '' ) );
$commentdata['comment_agent'] = apply_filters( 'pre_comment_user_agent', ( isset( $commentdata['comment_agent'] ) ? $commentdata['comment_agent'] : '' ) );

常見問題

FAQs
檢視更多 >