acf_get_pretty_post_statuses()
Function acf_get_pretty_post_statuses()
Returns a clean array of post status names.
Хуков нет.
Возвращает
Массив
. An array of post status names.
Использование
acf_get_pretty_post_statuses( $post_statuses );
- $post_statuses(массив)
- An array of post status objects.
По умолчанию: empty array
Список изменений
С версии 6.1.0 | Введена. |
Код acf_get_pretty_post_statuses() acf get pretty post statuses ACF 6.4.2
function acf_get_pretty_post_statuses( $post_statuses = array() ) { // Get all post statuses. $post_statuses = array_merge( $post_statuses, acf_get_post_stati() ); $ref = array(); $result = array(); foreach ( $post_statuses as $post_status ) { $label = acf_get_post_status_label( $post_status ); $result[ $post_status ] = $label; if ( ! isset( $ref[ $label ] ) ) { $ref[ $label ] = 0; } ++$ref[ $label ]; } foreach ( array_keys( $result ) as $i ) { $post_status = $result[ $i ]; if ( $ref[ $post_status ] > 1 ) { $result[ $i ] .= ' (' . $i . ')'; } } return $result; }