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
檢視更多 >