How to add custom fields in rss feed

I have a custom field called argument. I’m trying to add it in RSS feed using the following code, but it’s not working. Am I missing something?

function acf_feed($content) {  
    if(is_feed()) {  
        $post_id = get_the_ID();  
        $output="<acfArgument>" . get_post_meta($post_id, "argument", true) . '</acfArgument>';  
        $content = $content.$output;  
    }  
    return $content;  
}  
add_filter('the_content','acf_feed');

I added this function to function.php

Some help would be appreciated.

0

Leave a Comment