【问题标题】:Retrieving the tags for a post from a Wordpress plugin从 Wordpress 插件中检索帖子的标签
【发布时间】:2009-07-28 15:17:47
【问题描述】:

我是 Wordpress 插件的新手,并且正在编辑其他人的插件以添加功能。我需要检索特定帖子的标签。

get post 函数已在插件内部使用并返回类别信息。不幸的是,标签没有返回任何内容。

get the tags 函数似乎是最合适的,但它只在 Wordpress 循环内运行。我的理解是插件在循环之外运行。

我没有在 API 参考中找到任何其他内容。

如何检索帖子的标签?

【问题讨论】:

  • 插件不一定在循环之外运行。这取决于您使用的是哪个钩子。

标签: php wordpress tags


【解决方案1】:

试试这个

get_the_tags($post->ID)

【讨论】:

    【解决方案2】:

    http://wordpress.org/support/topic/191245

    该链接背后的几个解决方案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-05
      相关资源
      最近更新 更多