WordPress导入忽略post_parent

时间:2014-03-18 21:31:11

标签: wordpress import custom-post-type

我尝试导入自定义帖子类型的数据:

<item>
                <title>sausages</title>
        <link>http://localhost:10293/?gmc_recipeingredient=sausages</link>
        <pubDate>Tue, 18 Mar 2014 21:18:03 +0000</pubDate>
        <dc:creator><![CDATA[KevinUK]]></dc:creator>
        <guid isPermaLink="false">http://localhost:10293/?gmc_recipeingredient=sausages</guid>
        <description></description>
        <content:encoded><![CDATA[]]></content:encoded>
        <excerpt:encoded><![CDATA[]]></excerpt:encoded>
        <wp:post_id>123</wp:post_id>
        <wp:post_date>2014-03-18 21:18:03</wp:post_date>
        <wp:post_date_gmt>2014-03-18 21:18:03</wp:post_date_gmt>
        <wp:comment_status>open</wp:comment_status>
        <wp:ping_status>open</wp:ping_status>
        <wp:post_name>sausages</wp:post_name>
        <wp:status>publish</wp:status>
        <wp:post_parent>112</wp:post_parent>
        <wp:menu_order>1</wp:menu_order>
        <wp:post_type>gmc_recipeingredient</wp:post_type>
        <wp:post_password></wp:post_password>
        <wp:is_sticky>0</wp:is_sticky>
        <wp:postmeta>
            <wp:meta_key>gmc-ingredientquantity</wp:meta_key>
            <wp:meta_value><![CDATA[2]]></wp:meta_value>
        </wp:postmeta>
    </item>

post_parent是112,但是一旦我导入并查看wp_posts表,即使id为112的帖子存在,记录也有0作为post_parent。

它正确地将记录添加到wp_posts和wp_postmeta,那么为什么不为post_parent添加值?所有其他字段看起来都已正确填充。

1 个答案:

答案 0 :(得分:2)

我在插件(https://wordpress.org/plugins/wp-re-importer/faq/

中找到了这些信息
  

标准的WordPress导入器只设置帖子的post_parent(如果是这样)   帖子也存在于导入中;它无法将导入的帖子映射到   已存在于数据库中的帖子。

当我导出所有内容&#39;相反,我的问题中的我的片段成功显示。