spot_img
HomeWordPress教程wordpress建站公司 将帖子导入 Wordpress 所需的格式是什么?

wordpress建站公司 将帖子导入 WordPress 所需的格式是什么?

JasperAI 10000字免费额度试用

我在 Microsoft Excel 文件 (.csv/.xls) 中有几篇文章。 我想知道要导入 WordPress.com 的文件的适当格式。

注意:我不需要帮助将 csv 格式转换为 xml。 我只需要知道输入 WordPress 所需的格式。 同样的方法应该适用于 .org 托管的博客。

目前我已经从 WordPress 中提取了一个带有必要标题的 WordPress XML 文件。 我相信我需要做的就是为每个新帖子填充以下 XML 代码。

哪些字段可以排除? 哪些字段可以留空? 成功导入文件和代码的示例将不胜感激。

我尝试了两次导入 WordPress 并确认成功,但是我看不到任何一个帖子? 所以我怀疑我的文件有问题。

 <Item>     
      <title>   My Post Title   </title>
      <link>    My Post URL </link>
      <pubDate> Sun, 01 Jan 2012 00:00:00 +0000 </pubDate>
      <dc:creator>  Author  </dc:creator>
      <guid isPermaLink="false">    My Post WP URL  </guid isPermaLink="false">
      <description> My Post Description </description>
      <content:encoded> My Post Content </content:encoded>
      <excerpt:encoded> My Post Excerpt </excerpt:encoded>
      <wp:post_id>  My Post ID  </wp:post_id>
      <wp:post_date>    2012-01-01 00:00:00 </wp:post_date>
      <wp:post_date_gmt>    2012-01-01 00:00:00 </wp:post_date_gmt>
      <wp:comment_status>   Open    </wp:comment_status>
      <wp:ping_status>  Open    </wp:ping_status>
      <wp:post_name>    My Post Title   </wp:post_name>
      <wp:status>   inherit </wp:status>
      <wp:post_parent>  My Post Parent ID   </wp:post_parent>
      <wp:menu_order>   0   </wp:menu_order>
      <wp:post_type>    attachment  </wp:post_type>
      <wp:post_password>        </wp:post_password>
      <wp:is_sticky>    0   </wp:is_sticky>
      <wp:attachment_url>       </wp:attachment_url>
 </Item>        

这是一个导入文件,其中仅使用了一些设置(尽管您可以排除更多设置),它成功导入了三个帖子(在 WP 4.2.2 上测试):

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0"
    xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:wp="http://wordpress.org/export/1.2/" >

    <channel>
        <wp:wxr_version>1.2</wp:wxr_version>

        <item>
            <title>My first post</title>
            <dc:creator><![CDATA[admin]]></dc:creator>
            <description></description>
            <content:encoded><![CDATA[
<p>Welcome to my first post!</p>
]]></content:encoded>
            <excerpt:encoded><![CDATA[]]></excerpt:encoded>
            <wp:post_date>2015-03-01 16:20:00</wp:post_date>
            <wp:status>publish</wp:status>
            <wp:post_type>post</wp:post_type>
        </item>

        <item>
            <title>My second post</title>
            <dc:creator><![CDATA[admin]]></dc:creator>
            <description></description>
            <content:encoded><![CDATA[
<p>Welcome to my second post!</p>
]]></content:encoded>
            <excerpt:encoded><![CDATA[]]></excerpt:encoded>
            <wp:post_date>2015-03-02 16:20:00</wp:post_date>
            <wp:status>publish</wp:status>
            <wp:post_type>post</wp:post_type>
        </item>

        <item>
            <title>My third post</title>
            <dc:creator><![CDATA[admin]]></dc:creator>
            <description></description>
            <content:encoded><![CDATA[
<p>Welcome to my third post!</p>
]]></content:encoded>
            <excerpt:encoded><![CDATA[]]></excerpt:encoded>
            <wp:post_date>2015-03-03 16:20:00</wp:post_date>
            <wp:status>publish</wp:status>
            <wp:post_type>post</wp:post_type>
        </item>

    </channel>
</rss>

如果您只需要 WordPress XML 导入文件的已知良好示例,请尝试主题单元测试数据 XML 文件。

高质量外链购买

如果 Excel 文件中的代码格式正确,您还可以查看其他选项,例如导入 (X)HTML。

如果您想了解 WordPress 实际上是如何构建其“扩展 RSS”(XML) 文件的,请参阅 wp-admin/includes/export.php.

如果你想看看 WordPress 如何 进口 数据,见 wp-admin/includes/class-wp-import.php 和导入插件的 wordpress-importer.phpparsers.php.

至于实际上是什么数据 必需的, 我会 认为 它只是数据库中主键的任何内容。 但是要仔细检查以上两个文件才能确定。

5分钟生成10篇英文软文article forge软件试用
siteground guangda
WordPress花园官方账号
WordPress花园隶致力于为广大跨境电商和独立站爱好者提供优质的WordPress教程、Woocommerce教程、Facebook、Twitter、tiktok、Instagram教程和谷歌SEO教程等资料和对应的建站推广服务。关注‘哟派出海’公众号了解最新资讯。粉丝福利:Shopline免费独立站建设14天优惠 商务合作: [email protected]
RELATED ARTICLES
spot_img