get_post_status_object

函式
get_post_status_object ( $post_status )
引數
  • (string) $post_status The name of a registered post status.
    Required:
返回值
  • (stdClass|null) A post status object.
相關
  • register_post_status()
定義位置
相關方法
get_post_statusesget_post_type_objectget_post_statusget_post_statesget_post_stati
引入
3.0.0
棄用
-

get_post_status_object: 這個函式為一個給定的文章狀態檢索狀態物件。狀態物件包括諸如標籤、名稱、公共、以及狀態的內部屬性等資訊。

按名稱檢索一個文章狀態物件。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function get_post_status_object( $post_status ) {
global $wp_post_statuses;
if ( empty( $wp_post_statuses[ $post_status ] ) ) {
return null;
}
return $wp_post_statuses[ $post_status ];
}
function get_post_status_object( $post_status ) { global $wp_post_statuses; if ( empty( $wp_post_statuses[ $post_status ] ) ) { return null; } return $wp_post_statuses[ $post_status ]; }
function get_post_status_object( $post_status ) {
	global $wp_post_statuses;

	if ( empty( $wp_post_statuses[ $post_status ] ) ) {
		return null;
	}

	return $wp_post_statuses[ $post_status ];
}

常見問題

FAQs
檢視更多 >