Featured image from RSS syndicated article
-
Hey guys.
I am having issues with my articles sourced from RSS. I have a site that is obtaining posts from an RSS feed. The feed contains media files [e.g. 2209724-16×9-940×529.jpg (JPEG Image)]. To source these articles, I am using FeedWordPress, which gets the files and then inserts them into my posts.
The problem now, is that I try to then, use the first image on the post, as a featured image. Either automatically or manually, it will not work.
Automatic attempt courtesy of code from wp-snippet.com:function autoset_featured() { global $post; $already_has_thumb = has_post_thumbnail($post->ID); if (!$already_has_thumb) { $attached_image = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" ); if ($attached_image) { foreach ($attached_image as $attachment_id => $attachment) { set_post_thumbnail($post->ID, $attachment_id); } } } } add_action('the_post', 'autoset_featured'); add_action('save_post', 'autoset_featured'); add_action('draft_to_publish', 'autoset_featured'); add_action('new_to_publish', 'autoset_featured'); add_action('pending_to_publish', 'autoset_featured'); add_action('future_to_publish', 'autoset_featured');Manual attempt:
Open post
Set image
Select “set Featured image”
Select image from media library
^^ “this is an image in post from RSS. I have not manually uploaded”
Set featured image.
Media library closes – no result. It does not update.What I’ve tried:
– Disabling theme and trying with another theme (same issue)
– Tried using an image that was manually uploaded – WORKS.Is there any possible cause for this. Any help would be appreciated.
The topic ‘Featured image from RSS syndicated article’ is closed to new replies.