How Create a WordPress Custom RSS Feed Using Hooks?


Hello Everyone!

Hope you all are doing well 🙂

I am here going to tell you all my friends for how to create a custom own RSS Feed using hooks in wordpress site.

its actually very easy to do – easy peasy. all you have to do is add a new function to the function.php file in your theme’s folder.
something like this:

function raghu_feed() {
header('Content-Type: text/xml; charset='.get_option('blog_charset'), true);
echo '<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
// insert all the feed stuff you want here
</rss>';
}
add_feed('feed_by_raghu', 'raghu_feed');

How can access the feed in front end?

you can then access the feed at http://www.example.com/?feed=feed_by_raghu

Enjoy Code! | Enjoy My Blog 🙂 🙂

Advertisements

Sr. Software Engineer

Tagged with: , , , ,
Posted in Wordpress
One comment on “How Create a WordPress Custom RSS Feed Using Hooks?
  1. Lynne Drehs says:

    Pretty slice of pleased. I immediately stumbled upon your situate and in accession first city to assert that I acquire in piece of evidence enjoyed account your blog posts. At any rate I will be subscribing to your expand and equal I achievement you access consistently quickly.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: