comments_array

過濾鉤子
apply_filters( 'comments_array', $comments_flat, $post->ID )
引數
  • (array) $comments Array of comments supplied to the comments template.
    Required:
  • (int) $post_id Post ID.
    Required:
定義位置
相關勾子
comment_urlcomment_authorcomments_per_pagecomment_atom_entrycomment_form
相關方法
comments_rsscomment_authorcomment_author_urlcomment_datecomments_numbercomment_type
引入
2.1.0
棄用
-

comments_array: 這個函式用來檢索一個給定文章的評論陣列。預設情況下,這個函式會返回該文章的所有評論,但你可以使用comments_array過濾器來修改返回的評論。

過濾評論陣列。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$wp_query->comments = apply_filters( 'comments_array', $comments_flat, $post->ID );
$wp_query->comments = apply_filters( 'comments_array', $comments_flat, $post->ID );
$wp_query->comments = apply_filters( 'comments_array', $comments_flat, $post->ID );

常見問題

FAQs
檢視更多 >