Skip to content

Instantly share code, notes, and snippets.

View fabioricali's full-sized avatar
🏠
Beep beeeep

Fabio Ricali fabioricali

🏠
Beep beeeep
View GitHub Profile
@fabioricali
fabioricali / Wordpress RSS 2.0 image enclosure [COMPLETE with IMG filesize included].php
Last active July 14, 2020 08:50 — forked from DaveyJake/wp-rss2-image-enclosure.php
How to add an enclosure to a wordpress RSS feed using the first image of the post [with its actual length attribute value] - add to functions.php
add_filter( 'pre_get_posts', 'feed_filter' );
function feed_filter( $query ) {
if ( $query->is_feed ) {
add_filter( 'rss2_item', 'feed_content_filter');
}
return $query;
}
function feed_content_filter() {
global $post;