Core Function
View Source on Trac ↗ has_tag()
has_tag( mixed $tag = '', mixed $post = null ) Checks if the current post has any of given tags.
Parameters 2 required
| Name / Type | Description |
|---|---|
| mixed | (string | int | array) $tag Optional. The tag name/term_id/slug, or an array of them to check for. Default empty. Required |
| (int | | WP_Post) $post Optional. Post to check. Defaults to the current post. Required |
Return Value
(bool)
bool True if the current post has any of the given tags
(or any tag, if no tag specified). False otherwise.
Function Information
Since Version
2.6.0
Source File
wp-includes/category-template.php
Advertisement