• I’m trying to add featured images to my RSS feed, on a blog running a pinbin child theme.

    – When I install and activate the plugin “Add featured image to RSS feed” it works.
    – When I try to paste the code of this plugin in my functions.php file it works
    – When I try to paste the code of this plugin in my child functions.php file it doesn’t work (the featured image is not added to the rss feed).

    The code is

    function add_featured_image_to_feed($content) {
        global $post;
        if ( has_post_thumbnail( $post->ID ) ){
            $content = '' . get_the_post_thumbnail( $post->ID, 'large' ) . '' . $content;
        }
        return $content;
    }
    
    add_filter('the_excerpt_rss', 'add_featured_image_to_feed', 1000, 1);
    add_filter('the_content_feed', 'add_featured_image_to_feed', 1000, 1);

    What could I be doing wrong? Of course my blog is using the child theme and I’ve checked that other functions in the child functions.php file are working.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Function working in theme but not child theme’ is closed to new replies.