使用 WXR 格式将 post 标签导入 Wordpress

Importing post tags into Wordpress with the WXR format

我正在从遗留系统转移到 Wordpress。我读到 WXR 导入格式没有正式记录,但是 this sample can be used as documentation.

话虽如此,为什么这个 post 没有用 "awesome" 标记? awesome 标签是在 WXR 文件的顶部创建的

<tag>
    <term_idname>2781</term_idname>
    <tag_slug>awesome</tag_slug>
    <tag_name>
        <![CDATA[awesome]]>
    </tag_name>
</tag>

而且我导入后在后台找到了。然而 post 没有被标记。没有 post 被标记。但是所有标签都是导入的,只有 0 children。这就是我尝试导入 post 的方式:

<item>
    <title>The title is awesome</title>
    <link>http://example.com/awesome</link>
    <creator>This Ramvi</creator>
    <guid isPermaLink="false">http://example.com/awesome</guid>
    <description></description>
    <encoded>
        <![CDATA[<p>Very short post
        </p>]]>
    </encoded>
    <post_id>843156</post_id>
    <post_date>2014-10-22 10:34</post_date>
    <post_date_gmt>2014-10-22 08:34</post_date_gmt>
    <comment_status>open</comment_status>
    <ping_status>open</ping_status>
    <post_name>Really awesome post</post_name>
    <status>publish</status>
    <category domain="tag">
        <![CDATA[awesome]]>
    </category>
    <post_type>post</post_type>
</item>

你能看出我做错了什么吗?

答案几乎都在问题中链接的示例中。您需要两行代码才能将标签添加到 post:

<category domain="tag"><![CDATA[NewTag]]></category>
<category domain="tag" nicename="newtag"><![CDATA[NewTag]]></category>