Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Minimum WordPress Plugin that adds <image> Tags to the RSS2 Feed. Add this file to a folder calles /wp-content/plugins/rss2-feed-with-images/
<?php
/*
Plugin Name: RSS2 Feed with Images
Plugin URI:
Description: Add image objects to the RSS2 Feed
Version: 1.1
Author: Jan Thiel
Author URI: https://hive-it.de
License: GPL2
*/
add_action( 'rss2_item', 'add_images_to_rss2_feed' );
function add_images_to_rss2_feed() {
global $post;
if ( has_post_thumbnail( $post->ID ) ) {
$thumbnail = get_the_post_thumbnail_url( $post->ID, 'full' );
echo("<image>{$thumbnail}</image>");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.