pings_open

函数
pings_open ( $post = null )
参数
  • (int|WP_Post) $post Post ID or WP_Post object. Default current post.
    Required:
    Default: null
返回值
  • (bool) True if pings are accepted
定义位置
相关方法
comments_openwp_doing_cronwp_insert_commentis_homeis_page
引入
1.5.0
弃用
-

pings_open: 这个函数用来检查当前文章的pingbacks是否开放。它返回一个布尔值。

确定当前文章是否开放供ping。

关于这个和类似主题功能的更多信息,请查看《主题开发者手册》中的{@link Conditional Tags}文章。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function pings_open( $post = null ) {
$_post = get_post( $post );
$post_id = $_post ? $_post->ID : 0;
$open = ( $_post && ( 'open' === $_post->ping_status ) );
/**
* Filters 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 $post_id The post ID.
*/
return apply_filters( 'pings_open', $open, $post_id );
}
function pings_open( $post = null ) { $_post = get_post( $post ); $post_id = $_post ? $_post->ID : 0; $open = ( $_post && ( 'open' === $_post->ping_status ) ); /** * Filters 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 $post_id The post ID. */ return apply_filters( 'pings_open', $open, $post_id ); }
function pings_open( $post = null ) {
	$_post = get_post( $post );

	$post_id = $_post ? $_post->ID : 0;
	$open    = ( $_post && ( 'open' === $_post->ping_status ) );

	/**
	 * Filters 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  $post_id The post ID.
	 */
	return apply_filters( 'pings_open', $open, $post_id );
}

常见问题

FAQs
查看更多 >