wp_get_single_post

函式
wp_get_single_post ( $postid = 0, $mode = OBJECT )
引數
  • (int) $postid Post ID.
    Required:
  • (string) $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A.
    Required:
    Default: OBJECT
返回值
  • (WP_Post|null) Post object or array holding post contents and information
相關
  • get_post()
定義位置
相關方法
get_next_postwp_get_recent_postswp_insert_postwp_remote_postwp_delete_post
引入
1.0.0
棄用
3.5.0

wp_get_single_post: 這個函式為一個給定的文章ID檢索一個單一的文章物件。如果找到該文章,它將返回一個WP_Post物件,如果該文章不存在,則返回空。

根據文章ID,檢索單個文章。

在’post_category’屬性或鍵中有類別。在’tags_input’屬性中擁有標籤或金鑰。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_get_single_post( $postid = 0, $mode = OBJECT ) {
_deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' );
return get_post( $postid, $mode );
}
function wp_get_single_post( $postid = 0, $mode = OBJECT ) { _deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' ); return get_post( $postid, $mode ); }
function wp_get_single_post( $postid = 0, $mode = OBJECT ) {
	_deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' );
	return get_post( $postid, $mode );
}

常見問題

FAQs
檢視更多 >