At the risk of sounding completely ridiculous, I'm posting this question here as the nature of my query doesn't seem to help me much from google.

My WordPress default RSS feeds makes use of post excerpt this feed is accessed via www.mydomain.com/feed

I have a requirement to make another RSS feed that is the full text. How can create an additional RSS feed (that is private/given to only trusted parties)? Preferably using a function but a plugin (as a last resort).

2 Answers 2


Here is how to create a custom feed:

first create a new file in your theme's directory , name it your-custom-feed.php and put this code inside


      * custom RSS feed.
      * @package WordPress

     header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);
     $more = 1;

    echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>

    <rss version="2.0"
        <?php do_action('rss2_ns'); ?>

            <title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
            <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
            <link><?php bloginfo_rss('url') ?></link>
            <description><?php bloginfo_rss("description") ?></description>
            <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
            <language><?php echo get_option('rss_language'); ?></language>
            <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
            <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>
            <?php do_action('rss2_head'); ?>
            <?php while( have_posts()) : the_post(); ?>
                <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>
                <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; ?>

                <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'); ?>
            <?php endwhile; ?>

then add a simple function to call that template file using do_feed_$hook

//load feed template
function create_my_customfeed() {
    load_template( TEMPLATEPATH . 'your-custom-feed.php'); 
add_action('do_feed_mycustomfeed', 'create_my_customfeed', 10, 1);

Now when you access http://yoursite.com/?feed=mycustomfeed you will get a full text feed, no mater what you define inside WordPress admin.


if you want to create a rewrite rule for your custom feed so your url could be:

http://yoursite.com/mycustomfeed.xml as well as a http://yoursite.com/feed/mycustomfeed/

add this code to your functions.php file:

//create feed rewirte rule

function custom_feed_rewrite($wp_rewrite) {
    $feed_rules = array('feed/(.+)' => 'index.php?feed=' . $wp_rewrite->preg_index(1),'(.+).xml' => 'index.php?feed='. $wp_rewrite->preg_index(1));
    $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
  • Thanks for this brilliant tutorial. When i create the file (full-feed.php) and call it mysite.com/?feed=full-feed I get the following error ERROR: full-feed is not a valid feed template. Jul 14, 2011 at 6:42
  • you need to change the hook, and file name in the code
    – Bainternet
    Jul 14, 2011 at 6:55
  • ahh my bad. Fixed. But I check the feed and it still gives out only a couple of lines from every post?? Jul 14, 2011 at 7:21

Try something like this (not tested, simplified from more complex code):

add_feed('full', 'full_feed');

function full_feed() {

    add_filter('pre_option_rss_use_excerpt', '__return_zero');
    load_template( ABSPATH . WPINC . '/feed-rss2.php' );
  • Sure, I assume this code goes into functions.php but which file to call? There is already a /feed that goes default with the regular excerpt. So there needs to be another file or name that needs to be called?? Jul 14, 2011 at 7:28
  • @Sledge81 the first argument of add_feed() is slug of feed being created. So this additional feed will be at /feed/full or ?feed=full (former depends if you have pretty permalinks enabled).
    – Rarst
    Jul 14, 2011 at 8:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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