is_archive()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
is_archive(): bool
Описание
К страницам архива относятся архивы по рубрикам, меткам, авторам, датам, произвольным типам записей и произвольным таксономиям.
Подробнее об этой и похожих функциях темы см. статью Conditional Tags в Theme Developer Handbook.
См. alsois_category()
is_tag()
is_author()
is_date()
is_post_type_archive()
is_tax()
Оригинал (английский)
Archive pages include category, tag, author, date, custom post type, and custom taxonomy based archives.
For more information on this and similar theme functions, check out the Conditional Tags article in the Theme Developer Handbook.
Возвращаемое значение
bool
Исходный код
wp-includes/query.php:161
function is_archive() {
global $wp_query;
if ( ! isset( $wp_query ) ) {
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
return false;
}
return $wp_query->is_archive();
}
История изменений
| Версия | Описание |
|---|---|
| 1.5.0 | Introduced. |

