我们有时可能会用到检查 WordPress 数据库中是否存在某个标签,例如一个按钮需要链接某个标签,当标签不存在时,则不显示按钮。
$term = term_exists( 'tag1' ); if ( $term !== 0 && $term !== null ) { echo '存在'; } else { echo '不存在'; }
检查是否存在标签tag1.文章源自知更鸟-https://zmingcx.com/check-if-tag-exists-in-wp-database.html 文章源自知更鸟-https://zmingcx.com/check-if-tag-exists-in-wp-database.html

我的微信
版权声明
本站原创文章转载请注明文章出处及链接,谢谢合作!
四川省 1F
这个有用,优化不错