функция
since 3.1.0
_post_format_get_terms()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
_post_format_get_terms( array $terms, string|array $taxonomies, array $args ): array
Описание
Удаляет префикс формата записи из свойства name объектов терминов, созданных функцией get_terms() .
Параметры
$terms
array
обязательный
$taxonomies
string|array
обязательный
$args
array
обязательный
Возвращаемое значение
array
Исходный код
wp-includes/post-formats.php:234
function _post_format_get_terms( $terms, $taxonomies, $args ) {
if ( in_array( 'post_format', (array) $taxonomies, true ) ) {
if ( isset( $args['fields'] ) && 'names' === $args['fields'] ) {
foreach ( $terms as $order => $name ) {
$terms[ $order ] = get_post_format_string( str_replace( 'post-format-', '', $name ) );
}
} else {
foreach ( (array) $terms as $order => $term ) {
if ( isset( $term->taxonomy ) && 'post_format' === $term->taxonomy ) {
$terms[ $order ]->name = get_post_format_string( str_replace( 'post-format-', '', $term->slug ) );
}
}
}
}
return $terms;
}
История изменений
| Версия | Описание |
|---|---|
| 3.1.0 | Introduced. |

