is_tag()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
is_tag( int|string|int[]|string[] $tag = '' ): bool
Описание
Если задан параметр $tag, дополнительно проверяет, относится ли запрос к одной из указанных меток.
Подробнее об этой и похожих функциях темы см. статью Conditional Tags в Theme Developer Handbook.
Оригинал (английский)
If the $tag parameter is specified, this function will additionally check if the query is for one of the tags specified.
For more information on this and similar theme functions, check out the Conditional Tags article in the Theme Developer Handbook.
Параметры
$tag
int|string|int[]|string[]
необязательный
= ''
Возвращаемое значение
bool
Исходный код
wp-includes/query.php:300
function is_tag( $tag = '' ) {
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_tag( $tag );
}
История изменений
| Версия | Описание |
|---|---|
| 2.3.0 | Introduced. |

