WordPress.org

Ready to get started?Download WordPress

Forums

wp rewrite and custom RSS feed (4 posts)

  1. teknoledge
    Member
    Posted 4 years ago #

    I created a custom feed template "testfeed" which I want to use for categories e.g.: http://www.test.com/category-1/testfeed

    The problem I have is with wp_rewrite, I cant get it working:

    function custom_feed_rewrite($wp_rewrite) {
    	global $wp_rewrite;
    
    	$feed_rules = array(
    		'testfeed/(.+)' => 'index.php?feed=' . $wp_rewrite->preg_index(1)
    	);
    	$wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
    
        return $wp_rewrite;
    }
    add_filter('generate_rewrite_rules', 'custom_feed_rewrite');

    This works http://www.test.com/category-1/?feed=testfeed but I want to have nice URL's.

    Any help would be appreciated.

    Thanks!

  2. aufumy
    Member
    Posted 4 years ago #

    this article might have your answer
    http://www.seodenver.com/custom-rss-feed-in-wordpress/

    '(.+).xml' => 'index.php?feed='. $wp_rewrite->preg_index(1)

  3. PBP_Editor
    Member
    Posted 4 years ago #

    Did this work for you? I am trying the same thing.

    I can get the custom feed defined but I can't get the rewrite to work right. I tried the code on that linked page above and had no luck.

  4. romanczar
    Member
    Posted 4 years ago #

    Me too. Feed works, but rewriting fails...

Topic Closed

This topic has been closed to new replies.

About this Topic