1
在WordPress中插入評論時,我使用的是自定義評論類型'blog'。例如:如何獲得WordPress中的自定義評論類型的總評論數
wp_insert_comment(array(
'comment_post_ID' => $args['post_id'],
'comment_content' => wp_filter_post_kses($args['content']),
'comment_type' => 'blog',
'user_id' => $args['user']->ID,
'comment_author' => $args['user']->display_name,
'comment_author_email' => $args['user']->user_email,
'comment_author_url' => $args['user']->user_url,
));
如何獲得每個帖子的評論數?以下對我不起作用,因爲它顯示了「評論」類型的評論的計數。我需要顯示「博客」類型的評論總數。
wp_count_comments($post_id);