pings_open()判断文章ping功能是否开启

目录

描述

This Conditional Tag checks if trackbacks are allowed for the current Post or a given Post ID. This is a boolean function, meaning it returns either TRUE or FALSE.

pings_open() 描述

用法

<?php pings_open$post_id ); ?>

pings_open() 用法

参数

$post_id

(integer) (可选) The post ID

默认值: 0

pings_open() 参数

返回值

(boolean) 

True on success, false on failure.

pings_open() 返回值

历史

添加于 版本 1.5.0

pings_open() 历史

源文件

pings_open() 函数的代码位于 wp-includes/comment-template.php.

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * 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 );
}

pings_open() 源文件

相关