pings_open()
pings_open( int|WP_Post $post_id = null )
确定当前日志是否为ping打开。
Determines whether the current post is open for pings.
说明(Description)
有关此主题函数和类似主题函数的更多信息,请参阅主题开发人员手册中的条件标记文章。
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$post_id | (int | WP_Post) | 可选 | Post ID或WP_Post对象。默认当前职位。 |
返回(Return)
(bool)如果ping被接受,则为True
源码(Source)
/** * Whether the current post is open for pings. * * @since 1.5.0 * * @param int|WP_Post $post_id Post ID or WP_Post object. Default current post. * @return bool True if pings are accepted */ function pings_open( $post_id = null ) { $_post = get_post($post_id); $open = ( 'open' == $_post->ping_status ); /** * Filter whether the current post is open for pings. * * @since 2.5.0 * * @param bool $open Whether the current post is open for pings. * @param int|WP_Post $post_id The post ID or WP_Post object. */ return apply_filters( 'pings_open', $open, $post_id ); }
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
1.5.0 | wp-includes/comment-template.php:1263 | 6 | 3 |
pings_open() 为WP2原创文章,链接:https://www.wp2.cn/functions/pings_open/