comments_open()
comments_open( int|WP_Post $post_id = null )
确定当前文章是否为评论打开。
Determines whether the current post is open for comments.
说明(Description)
有关此主题函数和类似主题函数的更多信息,请参阅主题开发人员手册中的条件标记文章。
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$post_id | (int | WP_Post) | 可选 | Post ID或WP_Post对象。默认当前职位。 |
返回(Return)
(bool)如果注释是打开的,则为True。
源码(Source)
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
1.5.0 | wp-includes/comment-template.php:1233 | 11 | 3 |
笔记(Notes)
仅当我们看到一篇文章并且评论对当前文章开放时,才将脚本排队
使用此代码,您始终可以禁用页面上的注释,假设您的主题使用comments_open()检查注释是否打开。
comments_open() 为WP2原创文章,链接:https://www.wp2.cn/functions/comments_open-2/