Skip to content

Console Migrations should set the Owner of the Post #2999

@lindner

Description

@lindner

While trying to do this:

Import a Wordpress XML file.

I encountered this error:

Some entries would not import and the rest had an empty owner that causes the posts to not display.

Some of this can be fixed by passing true to $object->save(...), but it doesn't have the logged in user available.

Some other notes:

Give us some context:

Example XML

<?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>
<title>Test Blog</title>
<link>https://plindner.wordpress.com</link>
<description>Just another WordPress.com site</description>
<pubDate>Sun, 03 Oct 2021 20:43:44 +0000</pubDate>
<language>en</language>
<item>
  <title>Paul Lindner tagged Chris Schalk in Van Riper's album.</title>
  <link>https://plindner.wordpress.com/2012/02/17/paul-lindner-tagged-chris-schalk-in-van-ripers-album/</link>
  <pubDate>Fri, 17 Feb 2012 05:07:00 +0000</pubDate>
  <dc:creator>plindner</dc:creator>
  <guid isPermaLink="false">http://Paul-Lindner-tagged-Chris-Schalk-in-Van-Ripers-album</guid>
  <description/>
  <content:encoded><![CDATA[<!-- wp:image -->
<figure class="wp-block-image"><img src="http://plindner.files.wordpress.com/2012/02/ae823-photo.jpg" alt="" /></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p><a href="https://plus.google.com/117259934788907243749">Paul Lindner</a> tagged <a href="https://plus.google.com/104599745903075924418">Chris Schalk</a> in <a href="https://plus.google.com/109524702084450613375">Van Riper</a>'s album.</p>
<!-- /wp:paragraph -->]]></content:encoded>
  <excerpt:encoded><![CDATA[Paul Lindner tagged Chris Schalk in Van Riper's album.]]></excerpt:encoded>
  <wp:post_id>326</wp:post_id>
  <wp:post_date>2012-02-17 05:07:00</wp:post_date>
  <wp:post_date_gmt>2012-02-17 05:07:00</wp:post_date_gmt>
  <wp:post_modified>2012-02-17 05:07:00</wp:post_modified>
  <wp:post_modified_gmt>2012-02-17 05:07:00</wp:post_modified_gmt>
  <wp:comment_status>open</wp:comment_status>
  <wp:ping_status>open</wp:ping_status>
  <wp:post_name>paul-lindner-tagged-chris-schalk-in-van-ripers-album</wp:post_name>
  <wp:status>publish</wp:status>
  <wp:post_parent>0</wp:post_parent>
  <wp:menu_order>0</wp:menu_order>
  <wp:post_type>post</wp:post_type>
  <wp:post_password/>
  <wp:is_sticky>0</wp:is_sticky>
  <category domain="category" nicename="paul-lindner"><![CDATA[Paul Lindner]]></category>
  <wp:postmeta>
    <wp:meta_key>_publicize_pending</wp:meta_key>
    <wp:meta_value><![CDATA[1]]></wp:meta_value>
  </wp:postmeta>
  <wp:postmeta>
    <wp:meta_key>_import_original_post_id</wp:meta_key>
    <wp:meta_value><![CDATA[326]]></wp:meta_value>
  </wp:postmeta>
</item>
  </channel>
</rss>
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions