I'm trying to get a feed for pages and a separate feed for posts. The feed for posts works perfect as it is.

I just want a separate one but i have tried all the plugins and searched for about a week straight and still could not find a solution

Is it possible to take feed-rss2.php and duplicate it to change the code to include pages instead of posts and call it by ?feed=my_custom_feed?



This is the script that I am using get the <link> tag from the item RSS. I want the pages to have an RSS feed unless anyone knows a different way of doing it without RSS. But the script above rotates the page every 30 seconds.

  • Feeds don't report content updates, they report new content. So new posts are added to a feed as new items ... what are you trying to accomplish with a feed for pages? There's probably a better way to go about it.
    – EAMann
    May 21, 2012 at 23:51
  • please view the topic for update ....
    – Alcatraz
    May 22, 2012 at 0:01
  • Yeah, I'm looking at that code and I still haven't a clue what you're trying to do. Could you perhaps explain your goal using English instead?
    – Otto
    May 22, 2012 at 2:34

1 Answer 1


Feeds for post types are called with feed/?post_type=POSTTYPE. For no obvious reasons this doesn't work for the post type page – you get the posts instead.

But there is a filter to fix that: 'pre_get_posts'. Let's use it:

add_action( 'pre_get_posts', 't5_pages_in_feed' );

 * Set post type to 'page' if it was requested.
 * @param  object $query
 * @return void
function t5_pages_in_feed( &$query )
    if ( isset ( $_GET['post_type'] ) && $_GET['post_type'] === 'page' && is_feed() )
        $query->set( 'post_type', 'page' );

Now you get the page feed at /feed/?post_type=page.

Here is a plugin for that: T5 Page Feed

  • 1
    sorry im a bit of a wordpress/web newbie where would i put this ? in functions.php or feed-rss2.php ?
    – Alcatraz
    May 22, 2012 at 0:36
  • functions.php or better: a plugin. See my update.
    – fuxia
    May 22, 2012 at 0:47
  • ERROR: rss2 is not a valid feed template. <-- this is the error that i get when i try to use it directitpros.com/cbm/wp/feed/?post_type=page
    – Alcatraz
    May 22, 2012 at 1:03
  • That's from wp-includes/functions.php:do_feed(). Meaning: you have feeds disabled or some other strange filter is active. Disable all plugins and Use TwentyEleven. Do you still get the error?
    – fuxia
    May 22, 2012 at 1:09
  • AWESOME AWESOME works great thanks so much works great
    – Alcatraz
    May 22, 2012 at 3:28

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.