首页 WordPress函数大全 has_tag()

has_tag()

2020-05-02 / 4309阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

has_tag( string|int|array $tag = '', int|object $post = null )

Checks if the current post has any of given tags.

描述

The given tags are checked against the post’s tags’ term_ids, names and slugs. Tags given as integers will> Conditional Tags article in the Theme Developer Handbook.

参数

$tag

(string|int|array)
(Optional)
The tag name/term_id/slug or array of them to check for.

Default value: ''

$post

(int|object)
(Optional)
Post to check instead of the current post. (since 2.7.0)

Default value: null

返回

(bool) True if the current post has any of the given tags (or any tag, if no tag specified).

大家谈论
    我的见解