从 WordPress 函数中删除标签
尝试打印我的自定义帖子类型的分类,但没有链接。尝试过,但似乎不起作用,有什么建议吗?
$text = the_terms($post->ID,'type','','','');
echo strip_tags($text);
任何帮助将不胜感激...我要开始打婴儿了。
Trying to print my custom post type's taxonomy but without the link. Tried this, but doesn't seem to work, any suggestions?
$text = the_terms($post->ID,'type','','','');
echo strip_tags($text);
Any help would be greatly appreciated... I'm about to start punching babies.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
the_terms()
显示术语,但您无法将它们存储到变量中,因为它们是回显的。您应该尝试使用get_terms()
。为了将来使用,
the_something()
方法将特定内容打印到模板中,get_something()
方法返回内容,以便您可以将其存储到变量中。the_terms()
display the terms, but you cant store them into a variable because they are echoed. You should tryget_terms()
instead.For future use, the
the_something()
methods print the specific content ito the template and theget_something()
methods return the content so you can store it into a variable.在另一块板上的答案中找到的。这是一个链接。
https://wordpress.stackexchange.com/questions/3405/strip -tags-from-a-the-terms-function/
Found on the answer on the other board. Here's a link.
https://wordpress.stackexchange.com/questions/3405/strip-tags-from-a-the-terms-function/