How do you code a featured image into an XML as a jpg link, instead of using a data-id number?

All I want to do is get Wordpress's featured image XML code to use a jpeg link as the meta_value, instead of the image gallery data-id number.

Basically change this code:

wp:postmeta 
        wp:meta_key![CDATA[_thumbnail_id]]/wp:meta_key
        wp:meta_value![CDATA[202466]]/wp:meta_value
/wp:postmeta

To something reading like this:

wp:postmeta 
        wp:meta_key![CDATA[_thumbnail_id]]/wp:meta_key
        wp:meta_value![CDATA[http://xxxx.com/wp-content/uploads/xxxx.jpg]]/wp:meta_value
/wp:postmeta

I appreciate the help, hopefully its something simple enough.

Topic thumbnails xml post-thumbnails urls Wordpress

Category Web


You have to post two "items" in the xml. The first item is the "parent" portfolio-item... and the second is the attachment linking to the parent item. See below the entire XML rss. (I excluded all the information within the "item tag" which was not specific to this question to keep the answer light and easier to follow).

After writing this, upload the XML file using WordpressDashboard>>Tools>>import or (http://yourSite.com/wp-admin/import.php) Make certain you import checking the "Download/Import images" checkbox.

<rss>

<channel>
    <title>Portfolio-item Name</title>
    <link>http://example.com</link>
    <description>xxxxx</description>
    <pubDate></pubDate>
    <language>en-US</language>
    <wp:wxr_version>1.2</wp:wxr_version>
    <wp:base_site_url>http://example.com</wp:base_site_url>
    <wp:base_blog_url>http://example.com</wp:base_blog_url>


    <generator>https://wordpress.org/?v=5.8.3</generator>

<item>
<wp:post_id>1111111</wp:post_id>
<wp:postmeta> 
        <wp:meta_key><![CDATA[_thumbnail_id]]></wp:meta_key>
        <wp:meta_value><![CDATA[2222222]]></wp:meta_value>
</wp:postmeta>
</item>

Simultaneously add the attachment item which links via the id(number) you assign: In this case im using 2222222 as the image id.

<item>
<title><![CDATA[xxxxxxx.jpegName]]></title>
<wp:post_name><![CDATA[xxxxxxx.jpg]]></wp:post_name>
<dc:creator><![CDATA[]]></dc:creator>

    <link>http://example.com/?attachment_id=1111111</link>
    <wp:post_id>2222222</wp:post_id>
    <wp:status><![CDATA[inherit]]></wp:status>
    <wp:post_parent>1111111</wp:post_parent>
    <wp:post_type><![CDATA[attachment]]></wp:post_type>
    <wp:attachment_url><![CDATA[http://example.com/xxxxx.jpg]]></wp:attachment_url>
    
    <wp:postmeta>
    <wp:meta_key><![CDATA[_wp_attached_file]]></wp:meta_key>
    <wp:meta_value><![CDATA[xxxxxxx.jpg]]></wp:meta_value>
    </wp:postmeta>    
</item>


</channel>
</rss>

Hope this helps. It was difficult to find this, but I sorted it out, hopefully it will help another newbie like myself.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.