get_available_post_statuses

函式
get_available_post_statuses ( $type = 'post' )
引數
  • (string) $type The post_type you want the statuses for. Default 'post'.
    Required:
    Default: 'post'
返回值
  • (string[]) An array of all the statuses for the supplied post type.
定義位置
相關方法
get_available_post_mime_typesget_post_statusesget_available_languagesget_post_statesget_post_status
引入
2.5.0
棄用
-

get_available_post_statuses: 該函式在一個關聯陣列中返回可用的文章狀態。陣列的鍵值是狀態標題,值是相應的人類可讀字串: 該函式不接受任何引數。

返回一個文章型別的所有可能的狀態。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function get_available_post_statuses( $type = 'post' ) {
$stati = wp_count_posts( $type );
return array_keys( get_object_vars( $stati ) );
}
function get_available_post_statuses( $type = 'post' ) { $stati = wp_count_posts( $type ); return array_keys( get_object_vars( $stati ) ); }
function get_available_post_statuses( $type = 'post' ) {
	$stati = wp_count_posts( $type );

	return array_keys( get_object_vars( $stati ) );
}

常見問題

FAQs
檢視更多 >