• I want to create new custom rss feed. I added the following code to theme’s function.php file and also create separate template file.

    add_action(‘init’, ‘customRSS’);
    function customRSS(){
    add_feed(‘feedname’, ‘customRSSFunc’);
    }

    function customRSSFunc(){
    get_template_part(‘rss’, ‘feedname’);
    }

    But when I view the feed https://example.com/feed/feedname it shows 404 page not found error. Please help me to find what is wrong with this code.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello,

    You also need to refresh WordPress’ rewrite rule cache. This can be done by re-saving your permalink settings in Settings > Permalinks.

    https://codex.www.ads-software.com/Rewrite_API/flush_rules#What_it_does

    Hie sneha91,
    Hope you have made rss-feedname.php in your active theme.
    This is a glitch in your code. Please try this :

    add_action('init', 'customRSS');
    function customRSS(){
     add_feed('feedname', 'customRSSFunc');
     global $wp_rewrite;
     $wp_rewrite->flush_rules();
    }
    
    function customRSSFunc(){
     get_template_part('rss', 'feedname');
    }

    Hope you are getting your feeds now.
    Looking forward to hear from you.
    Thanks

    Thread Starter sneha91

    (@sneha91)

    Hello cedcommerce,

    I have made rss-feedname.php file in active theme and also I added new code which you mention but it shows the same error.

    Thanks for your reply

    Please set define(‘WP_DEBUG’, true); in your wp-config.php
    It will help you to get real error causing the issue.
    Can you please provide the actual link of your site, if you are OK with it.

    Also please make a try once again by using the code suggested by me earlier. After that go to settings->permalinks and just press save their. Now check you feed URL. It might get worked.

    Looking forward to hear from you.
    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘I got Custom feed 404 page not found Error’ is closed to new replies.