đŸ§± WordPress WXR

(WordPress eXtended RSS)

WordPress exporterar till en XML-fil som Ă€r:

  • RSS 2.0
  • Utökad med WordPress-specifika namnrymder
<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/"
>
<rss>
  <channel>
    <title>Webbplatsens namn</title>
    <link>https://example.com</link>
    <wp:wxr_version>1.2</wp:wxr_version>

    <!-- Users -->
    <wp:author>...</wp:author>

    <!-- Taxonomies -->
    <wp:category>...</wp:category>
    <wp:tag>...</wp:tag>

    <!-- Content -->
    <item>...</item>
    <item>...</item>

  </channel>
</rss>
<rss>
  <channel>
    <title>Webbplatsens namn</title>
    <link>https://example.com</link>
    <wp:wxr_version>1.2</wp:wxr_version>

    <!-- Users -->
    <wp:author>...</wp:author>

    <!-- Taxonomies -->
    <wp:category>...</wp:category>
    <wp:tag>...</wp:tag>

    <!-- Content -->
    <item>...</item>
    <item>...</item>

  </channel>
</rss>

📝 Struktur för ett inlĂ€gg (<item>)

Varje inlĂ€gg, sida, CPT, media = ett <item>

Minimal kÀrnstruktur

<item>
  <title>InlÀggets titel</title>
  <link>https://example.com/post-slug</link>
  <pubDate>Mon, 01 Jan 2024 12:00:00 +0000</pubDate>
  <dc:creator><![CDATA[admin]]></dc:creator>

  <guid isPermaLink="false">https://example.com/?p=123</guid>

  <description></description>
  <content:encoded><![CDATA[
    <p>Hela innehÄllet i HTML</p>
  ]]></content:encoded>
</item>

🧠 WordPress-specifika fĂ€lt (viktiga för integration)

<wp:post_id>123</wp:post_id>
<wp:post_date>2024-01-01 12:00:00</wp:post_date>
<wp:post_date_gmt>2024-01-01 11:00:00</wp:post_date_gmt>
<wp:post_modified>2024-01-02 08:00:00</wp:post_modified>
<wp:post_modified_gmt>2024-01-02 07:00:00</wp:post_modified_gmt>

<wp:post_type>post</wp:post_type> <!-- page, attachment, CPT -->
<wp:post_status>publish</wp:post_status>
<wp:post_name>slug</wp:post_name>
<wp:status>publish</wp:status>

<wp:comment_status>open</wp:comment_status>
<wp:ping_status>open</wp:ping_status>

đŸ§© Taxonomier (kategorier, taggar, custom)

<category domain="category" nicename="ekologi">
  <![CDATA[Ekologi]]>
</category>

<category domain="post_tag" nicename="hÄllbarhet">
  <![CDATA[hÄllbarhet]]>
</category>

<category domain="custom_taxonomy" nicename="nod-1">
  <![CDATA[Nod 1]]>
</category>

➡ domain = taxonomy
➡ nicename = slug


đŸ§Ÿ Metadata (custom fields, ACF, systemdata)

All metadata ligger som nyckel–vĂ€rde-par

<wp:postmeta>
  <wp:meta_key>_thumbnail_id</wp:meta_key>
  <wp:meta_value>456</wp:meta_value>
</wp:postmeta>

<wp:postmeta>
  <wp:meta_key>field_65a123abc</wp:meta_key>
  <wp:meta_value><![CDATA[Some value]]></wp:meta_value>
</wp:postmeta>

đŸ–Œ Media (attachments)

Media Ă€r ocksĂ„ <item>:

<item>
  <title>bild.jpg</title>
  <wp:post_type>attachment</wp:post_type>
  <wp:attachment_url>
    https://example.com/wp-content/uploads/2024/01/bild.jpg
  </wp:attachment_url>
</item>

Relationer:

  • InlĂ€gg refererar till media via meta (_thumbnail_id)
  • ID-baserat, inte URL-baserat