常用函数-wp_update_comment_count()

0条评论

常用函数-wp_update_comment_count()

说明

更新文章的评论计数。

$do_deferred为false(默认状态)且设置推迟评论时,$post_id将被添加到queue(队列)中,queue稍后将被更新,且每个文章编号仅更新一次。

如果评论未设置推迟,文章将被更新。$do_deferred设为true时,按照当前$post_id更新所有之前延迟的文章编号。

用法

<?php wp_update_comment_count( $post_id, $do_deferred ) ?>

参数

$post_id

(整数)(必需)文章编号

默认值:None

$do_deferred

(布尔值)(可选)是否对之前被推迟的文章评论计数进行操作

默认值:false

返回的值

(布尔值)

成功时返回true,出错则返回false

示例

注释

修改记录

自2.1.0版本后

源文件

wp_update_comment_count()位于 wp-includes/comment.php中。

相关资源

发表新评论

此内容将保密,不会被其他人看见。
  • 自动将网址与电子邮件地址转变为链接。
  • 允许HTML标签:<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • 自动断行和分段。

更多关於格式化选项的信息

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.