Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Would like to remove or edit it to be a static value without editing core Wordpress files. Preferably as a function.

share|improve this question
    
Why do you want to remove/edit this field? It's a fairly standard RSS field ... –  EAMann Apr 2 '12 at 20:25
add comment

2 Answers

  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.

share|improve this answer
add comment

Unfortunately, that element is hard-coded into WordPress core. Take a look at /wp-includes/feed-rss2.php:

<item>
    <title><?php the_title_rss() ?></title>
    <link><?php the_permalink_rss() ?></link>
    <comments><?php comments_link_feed(); ?></comments>
    <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
    <dc:creator><?php the_author() ?></dc:creator>
    <?php the_category_rss('rss2') ?>

    <guid isPermaLink="false"><?php the_guid(); ?></guid>
<?php if (get_option('rss_use_excerpt')) : ?>
    <description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
<?php else : ?>
    <description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
    <?php if ( strlen( $post->post_content ) > 0 ) : ?>
        <content:encoded><![CDATA[<?php the_content_feed('rss2') ?>]]></content:encoded>
    <?php else : ?>
        <content:encoded><![CDATA[<?php the_excerpt_rss() ?>]]></content:encoded>
    <?php endif; ?>
<?php endif; ?>
    <wfw:commentRss><?php echo esc_url( get_post_comments_feed_link(null, 'rss2') ); ?></wfw:commentRss>
    <slash:comments><?php echo get_comments_number(); ?></slash:comments>
<?php rss_enclosure(); ?>
<?php do_action('rss2_item'); ?>
</item>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.