Wordpress - Remove or Edit <dc:creator> in Feeds

  1. Copy /wp-includes/feed-rss2.php to your theme folder

  2. Edit it and make whatever changes you desire (e.g. removing the line for dc:creator)

  3. in your theme's functions.php file, add the following function:

remove_all_actions( 'do_feed_rss2' );  
function create_my_custom_feed() {  
    load_template( TEMPLATEPATH . '/feed-rss2.php');  
}  
add_action('do_feed_rss2', 'create_my_custom_feed', 10, 1);

Edit by Otto: While that will work, this would be a better way:

function create_my_custom_feed() {  
    load_template( TEMPLATEPATH . '/feed-rss2.php');  
}  
add_feed('rss2', 'create_my_custom_feed');

The add_feed() function is smart, and will handle the actions and such for you.

Note: It will require a one-time use of flush_rules() to take effect.


I was going to use the above answer from Otto but the more I looked at the templates the more it dawned on me that you don't need all that.

Just hook the_author filter and check is_feed if you want a RSS specific author.

function f_the_author( $display_name ) {

    // $display_name === string $authordata->display_name

    if ( is_feed() ) {
        return 'Static Feed Author Display Name Here';
    }

    return "Static Author Display Name";
}

add_filter( 'the_author', 'f_the_author', PHP_INT_MAX, 1 );

We were unable to get any of the other answers to this question to work for us. Maybe it was due to the theme we're using.

@Biranit Goren's solution resulted in a 500 error when we tried to load our RSS feed.

@jgraup's solution does work, but the Author field in all of our views for posts, pages, events, media library, etc. show as blank when we use the code in our functions.php file.

We did find the following, which worked. Credit goes to the following article: https://www.flynsarmy.com/2013/10/add-to-or-override-the-default-wordpress-rss-feed/

Copy the feed-rss2.php from the wp-includes directory to your child theme directory.

Modify the feed-rss2.php in your child theme's diectory as desired.

Add the following to your child theme’s functions.php file

remove_all_actions( 'do_feed_rss2' );
add_action( 'do_feed_rss2', function( $for_comments ) {
    if ( $for_comments )
        load_template( ABSPATH . WPINC . '/feed-rss2-comments.php' );
    else
    {
        if ( $rss_template = locate_template( 'feed-rss2.php' ) )
            // locate_template() returns path to file
            // if either the child theme or the parent theme have overridden the template
            load_template( $rss_template );
        else
            load_template( ABSPATH . WPINC . '/feed-rss2.php' );
    }
}, 10, 1 );

Tags:

Rss

Feed