【问题标题】:Is there a way to get the list of existing tags from a WordPress blog using AtomPub?有没有办法使用 AtomPub 从 WordPress 博客中获取现有标签列表?
【发布时间】:2011-04-13 18:42:26
【问题描述】:

我希望能够在 Wordpress 博客中查询现有标签的列表,以便在创建新帖子时提供这些标签。这可以通过 AtomPub 和 Wordpress 实现吗?我发现缺少 Wordpress AtomPub 支持的文档。我想知道这是否更多的是对 AtomPub 的限制而不是对 Wordpress 实现的限制。

【问题讨论】:

    标签: wordpress atom-feed atompub


    【解决方案1】:

    似乎Atom没有“标签”的概念,只有"categories"。由于AtomPub是基于它的,所以只指定a request for categories

    WordPress AtomPub 实现 calls get_categories() directly,当然,默认为 category 分类。但是,您可以通过get_categories_taxonomy 过滤参数,并将taxonomy 参数更改为包含post_tag 的数组。当然,只有在有 AtomPub 请求时才启用此过滤器。

    创建或更新帖子时,WordPress 只查看类别,因此您必须自己添加非类别术语。您可以通过挂钩 atompub_create_postatompub_put_post 钩子来做到这一点,它们会获取 WordPress 帖子 ID 和客户端发送的完整条目,其中包括所有条款。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-29
      相关资源
      最近更新 更多