I am looking for a way to rewrite my custom post type feed located at




this post suggests using


which is not the main feed but the comments feed, any ideas?


currently the above goes to comments as well.

  • Is your /portfolio/ address a real custom post type archive (with has_archive), or a "fake" one with a stub page (pre-3.1 I think)?
    – Jan Fabry
    Sep 12, 2011 at 11:00

2 Answers 2


Put this in a plugin or functions.php:

function feed_rewrite( $wp_rewrite ) {

    $feed_rules = array(
        'feed/portfolio'    =>  'index.php?post_type=post&feed=rss2'

    $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
// refresh/flush permalinks in the dashboard if this is changed in any way
add_filter( 'generate_rewrite_rules', 'feed_rewrite' );

When you've done that, go to the permalinks page and resave to flush your old rules and regenerate them

Remember, when changing rewrite rules to use the monkeyman rewrite analyser tool plugin to check what rules are used for which URLs

  • 1
    This turns out to be a solution at one of the many other things I wanted to do. :) Thanks mate
    – Janvier
    Aug 1, 2014 at 14:57

If you have the archive on CPT to true, that creat WP always a feed, the nice URL is only usable, after you refresh the permalinks via Settings in Backend or via a function in your code. Important is the name of your CPT, should the name is "portfolio". If you have another name, then you must create a rewrite, maybe with wp_rewrite() or via rules inside the .htaccess File, if it is a a Apache server.

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.