If you are moving your content from SoCast to a self-hosted WordPress site, you may want to ensure your featured images are properly imported and attached to your articles. Here’s how you can do it, step by step.
When you export your site (typically via a WordPress WXR/XML file), each post includes a meta field like this:
<thumbnail_url><![CDATA[https://example.com/uploads/my-image.jpg]]></thumbnail_url>
This field contains the featured image URL. However, WordPress will not automatically attach this image as the featured image when you import your content.
If you have access to a developer, you can automate the process by adding a code snippet to your theme’s functions.php
file or a custom plugin. Here’s an example:
add_action('import_post_meta', function($post_id, $key, $value) {
if ($key === '_thumbnail_url') {
$image_url = esc_url_raw($value);
$image_id = media_sideload_image($image_url, $post_id, null, 'id');
if (!is_wp_error($image_id)) {
set_post_thumbnail($post_id, $image_id);
}
}
}, 10, 3);
This code will:
_thumbnail_url
fieldNote: Make sure allow_url_fopen
is enabled on your server, and your import XML includes _thumbnail_url
as a meta tag.
If you are not a developer, you can use the WP All Import plugin to handle this process easily.
_thumbnail_url
as a Custom Field_thumbnail_url
value to the featured imageThat’s it! The plugin will download and attach the images for you.